Add option to change log file max size with [ui] logs_max_size

This commit is contained in:
Julien Wadel 2023-12-01 15:57:00 +01:00
parent 47be8c3432
commit 9fb849907f
3 changed files with 8 additions and 1 deletions

View file

@ -209,7 +209,7 @@ void Logger::init (const shared_ptr<linphone::Config> &config) {
linphone::Core::setLogCollectionPrefix(EXECUTABLE_NAME);
linphone::Core::setLogCollectionPath(Utils::appStringToCoreString(folder));
linphone::Core::setLogCollectionMaxFileSize(Constants::MaxLogsCollectionSize);
linphone::Core::setLogCollectionMaxFileSize(SettingsModel::getMaxLogsCollectionSize(config));
mInstance->enableFullLogs(SettingsModel::getFullLogsEnabled(config));
mInstance->enable(SettingsModel::getLogsEnabled(config));

View file

@ -1979,6 +1979,12 @@ QString SettingsModel::getLogsFolder (const shared_ptr<linphone::Config> &config
: Paths::getLogsDirPath());
}
size_t SettingsModel::getMaxLogsCollectionSize (const shared_ptr<linphone::Config> &config) {
return config
? config->getInt(UiSection, "logs_max_size", Constants::MaxLogsCollectionSize)
: Constants::MaxLogsCollectionSize;
}
bool SettingsModel::getLogsEnabled (const shared_ptr<linphone::Config> &config) {
return config ? config->getInt(UiSection, "logs_enabled", false) : true;
}

View file

@ -702,6 +702,7 @@ public:
// ---------------------------------------------------------------------------
static QString getLogsFolder (const std::shared_ptr<linphone::Config> &config);
static size_t getMaxLogsCollectionSize (const std::shared_ptr<linphone::Config> &config);
static bool getLogsEnabled (const std::shared_ptr<linphone::Config> &config);
static bool getFullLogsEnabled (const std::shared_ptr<linphone::Config> &config);