Allow to control logExpire from the config file

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
This commit is contained in:
Kevin Ottens 2020-07-01 16:03:45 +02:00
parent 808fb17809
commit be2d9d4838
3 changed files with 17 additions and 1 deletions

View File

@ -409,7 +409,7 @@ void Application::setupLogging()
auto logger = Logger::instance();
logger->setLogFile(_logFile);
logger->setLogDir(_logDir);
logger->setLogExpire(_logExpire);
logger->setLogExpire(_logExpire > 0 ? _logExpire : ConfigFile().logExpire());
logger->setLogFlush(_logFlush);
logger->setLogDebug(_logDebug || ConfigFile().logDebug());
if (!logger->isLoggingToFile() && ConfigFile().automaticLogDir()) {

View File

@ -74,6 +74,7 @@ static const char maxChunkSizeC[] = "maxChunkSize";
static const char targetChunkUploadDurationC[] = "targetChunkUploadDuration";
static const char automaticLogDirC[] = "logToTemporaryLogDir";
static const char logDebugC[] = "logDebug";
static const char logExpireC[] = "logExpire";
static const char proxyHostC[] = "Proxy/host";
static const char proxyTypeC[] = "Proxy/type";
@ -866,6 +867,18 @@ void ConfigFile::setLogDebug(bool enabled)
settings.setValue(QLatin1String(logDebugC), enabled);
}
int ConfigFile::logExpire() const
{
QSettings settings(configFile(), QSettings::IniFormat);
return settings.value(QLatin1String(logExpireC), 0).toBool();
}
void ConfigFile::setLogExpire(int hours)
{
QSettings settings(configFile(), QSettings::IniFormat);
settings.setValue(QLatin1String(logExpireC), hours);
}
QString ConfigFile::certificatePath() const
{
return retrieveData(QString(), QLatin1String(certPath)).toString();

View File

@ -95,6 +95,9 @@ public:
bool logDebug() const;
void setLogDebug(bool enabled);
int logExpire() const;
void setLogExpire(int hours);
// proxy settings
void setProxyType(int proxyType,
const QString &host = QString(),