Commit d4cbbebd authored by Kevin Ottens's avatar Kevin Ottens Committed by backportbot[bot]

Allow to control logExpire from the config file

Signed-off-by: default avatarKevin Ottens <kevin.ottens@nextcloud.com>
parent 727c1e9e
...@@ -410,7 +410,7 @@ void Application::setupLogging() ...@@ -410,7 +410,7 @@ void Application::setupLogging()
auto logger = Logger::instance(); auto logger = Logger::instance();
logger->setLogFile(_logFile); logger->setLogFile(_logFile);
logger->setLogDir(_logDir); logger->setLogDir(_logDir);
logger->setLogExpire(_logExpire); logger->setLogExpire(_logExpire > 0 ? _logExpire : ConfigFile().logExpire());
logger->setLogFlush(_logFlush); logger->setLogFlush(_logFlush);
logger->setLogDebug(_logDebug || ConfigFile().logDebug()); logger->setLogDebug(_logDebug || ConfigFile().logDebug());
if (!logger->isLoggingToFile() && ConfigFile().automaticLogDir()) { if (!logger->isLoggingToFile() && ConfigFile().automaticLogDir()) {
......
...@@ -74,6 +74,7 @@ static const char maxChunkSizeC[] = "maxChunkSize"; ...@@ -74,6 +74,7 @@ static const char maxChunkSizeC[] = "maxChunkSize";
static const char targetChunkUploadDurationC[] = "targetChunkUploadDuration"; static const char targetChunkUploadDurationC[] = "targetChunkUploadDuration";
static const char automaticLogDirC[] = "logToTemporaryLogDir"; static const char automaticLogDirC[] = "logToTemporaryLogDir";
static const char logDebugC[] = "logDebug"; static const char logDebugC[] = "logDebug";
static const char logExpireC[] = "logExpire";
static const char proxyHostC[] = "Proxy/host"; static const char proxyHostC[] = "Proxy/host";
static const char proxyTypeC[] = "Proxy/type"; static const char proxyTypeC[] = "Proxy/type";
...@@ -866,6 +867,18 @@ void ConfigFile::setLogDebug(bool enabled) ...@@ -866,6 +867,18 @@ void ConfigFile::setLogDebug(bool enabled)
settings.setValue(QLatin1String(logDebugC), 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 QString ConfigFile::certificatePath() const
{ {
return retrieveData(QString(), QLatin1String(certPath)).toString(); return retrieveData(QString(), QLatin1String(certPath)).toString();
......
...@@ -95,6 +95,9 @@ public: ...@@ -95,6 +95,9 @@ public:
bool logDebug() const; bool logDebug() const;
void setLogDebug(bool enabled); void setLogDebug(bool enabled);
int logExpire() const;
void setLogExpire(int hours);
// proxy settings // proxy settings
void setProxyType(int proxyType, void setProxyType(int proxyType,
const QString &host = QString(), const QString &host = QString(),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment