From b0a38816fc507c8f06f38c2bc2ecae8c153b8b87 Mon Sep 17 00:00:00 2001 From: Kevin Ottens Date: Mon, 5 Oct 2020 17:48:30 +0200 Subject: [PATCH] Change the defaults for logging Turn on the logging by default for everyone. Let's use a log dir within the config directory of the application and have debug logs expiring after a day. This obviously means we'll generate quite some logs but with the automated compression it shouldn't be too horrible. Obviously that scales with the amount of files and syncs occurring. In our tests with a large setup we're around 100 MB for a day worth of logs, this shouldn't be too much of an issue on today's average desktop/laptop. Signed-off-by: Kevin Ottens --- src/libsync/configfile.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/libsync/configfile.cpp b/src/libsync/configfile.cpp index c4e81110c..da4aca58e 100644 --- a/src/libsync/configfile.cpp +++ b/src/libsync/configfile.cpp @@ -901,8 +901,9 @@ void ConfigFile::setAutomaticLogDir(bool enabled) QString ConfigFile::logDir() const { + const auto defaultLogDir = QString(configPath() + QStringLiteral("/logs")); QSettings settings(configFile(), QSettings::IniFormat); - return settings.value(QLatin1String(logDirC), QString()).toString(); + return settings.value(QLatin1String(logDirC), defaultLogDir).toString(); } void ConfigFile::setLogDir(const QString &dir) @@ -914,7 +915,7 @@ void ConfigFile::setLogDir(const QString &dir) bool ConfigFile::logDebug() const { QSettings settings(configFile(), QSettings::IniFormat); - return settings.value(QLatin1String(logDebugC), false).toBool(); + return settings.value(QLatin1String(logDebugC), true).toBool(); } void ConfigFile::setLogDebug(bool enabled) @@ -926,7 +927,7 @@ void ConfigFile::setLogDebug(bool enabled) int ConfigFile::logExpire() const { QSettings settings(configFile(), QSettings::IniFormat); - return settings.value(QLatin1String(logExpireC), 0).toBool(); + return settings.value(QLatin1String(logExpireC), 24).toBool(); } void ConfigFile::setLogExpire(int hours)