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

Allow to control logDir from the config file

Signed-off-by: default avatarKevin Ottens <kevin.ottens@nextcloud.com>
parent d4cbbebd
......@@ -409,7 +409,7 @@ void Application::setupLogging()
// might be called from second instance
auto logger = Logger::instance();
logger->setLogFile(_logFile);
logger->setLogDir(_logDir);
logger->setLogDir(!_logDir.isEmpty() ? _logDir : ConfigFile().logDir());
logger->setLogExpire(_logExpire > 0 ? _logExpire : ConfigFile().logExpire());
logger->setLogFlush(_logFlush);
logger->setLogDebug(_logDebug || ConfigFile().logDebug());
......
......@@ -73,6 +73,7 @@ static const char minChunkSizeC[] = "minChunkSize";
static const char maxChunkSizeC[] = "maxChunkSize";
static const char targetChunkUploadDurationC[] = "targetChunkUploadDuration";
static const char automaticLogDirC[] = "logToTemporaryLogDir";
static const char logDirC[] = "logDir";
static const char logDebugC[] = "logDebug";
static const char logExpireC[] = "logExpire";
......@@ -855,6 +856,18 @@ void ConfigFile::setAutomaticLogDir(bool enabled)
settings.setValue(QLatin1String(automaticLogDirC), enabled);
}
QString ConfigFile::logDir() const
{
QSettings settings(configFile(), QSettings::IniFormat);
return settings.value(QLatin1String(logDirC), QString()).toString();
}
void ConfigFile::setLogDir(const QString &dir)
{
QSettings settings(configFile(), QSettings::IniFormat);
settings.setValue(QLatin1String(logDirC), dir);
}
bool ConfigFile::logDebug() const
{
QSettings settings(configFile(), QSettings::IniFormat);
......
......@@ -92,6 +92,9 @@ public:
bool automaticLogDir() const;
void setAutomaticLogDir(bool enabled);
QString logDir() const;
void setLogDir(const QString &dir);
bool logDebug() const;
void setLogDebug(bool enabled);
......
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