summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Kügler <sebas@kde.org>2017-01-06 16:46:13 (GMT)
committerSebastian Kügler <sebas@kde.org>2017-01-11 21:43:16 (GMT)
commit04a6483a01caaa17e476ac9e4a47725f0e1ca06f (patch)
tree41434ee590ddba9ebdecd836e908f8be8e7ba712
parent7f364342238af7b667ef64f4f63eb3077655b024 (diff)
disable logging to kscreen.log by default
Summary: Most of the issues that this feature should uncover have been uncovered, it makes sense to disable the logging (and futzing around with QCategorizedLogging) by default, and only use it to debug specific setups. Test Plan: Adjusted autotests accordingly. Reviewers: #plasma, mart Reviewed By: mart Subscribers: graesslin, plasma-devel Tags: #plasma Differential Revision: https://phabricator.kde.org/D3993 BUG:361688 CHANGELOG:Disable logging to kscreen.log by default, re-enable with export KSCREEN_LOGGING=1 cherry-picked from cea4c63f84650efa4
-rw-r--r--autotests/testlog.cpp8
-rw-r--r--src/log.cpp10
2 files changed, 14 insertions, 4 deletions
diff --git a/autotests/testlog.cpp b/autotests/testlog.cpp
index 47cd1df..76654d6 100644
--- a/autotests/testlog.cpp
+++ b/autotests/testlog.cpp
@@ -55,6 +55,7 @@ void TestLog::init()
void TestLog::initTestCase()
{
+ qputenv(KSCREEN_LOGGING, QByteArray("true"));
}
void TestLog::cleanupTestCase()
@@ -85,6 +86,13 @@ void TestLog::testEnabled()
qunsetenv(KSCREEN_LOGGING);
log = Log::instance();
+ QCOMPARE(log->enabled(), false);
+ QCOMPARE(log->logFile(), QString());
+
+ delete log;
+ qputenv(KSCREEN_LOGGING, QByteArray("truE"));
+
+ log = Log::instance();
QCOMPARE(log->enabled(), true);
QCOMPARE(log->logFile(), m_defaultLogFile);
diff --git a/src/log.cpp b/src/log.cpp
index dbb48a3..51b385e 100644
--- a/src/log.cpp
+++ b/src/log.cpp
@@ -57,7 +57,7 @@ class Log::Private
{
public:
QString context;
- bool enabled = true;
+ bool enabled = false;
QString logFile;
};
@@ -68,11 +68,13 @@ Log::Log() :
if (qEnvironmentVariableIsSet(logging_env)) {
const QString logging_env_value = qgetenv(logging_env).constData();
- if (logging_env_value == QStringLiteral("0") || logging_env_value.toLower() == QStringLiteral("false")) {
- d->enabled = false;
- return;
+ if (logging_env_value != QStringLiteral("0") && logging_env_value.toLower() != QStringLiteral("false")) {
+ d->enabled = true;
}
}
+ if (!d->enabled) {
+ return;
+ }
d->logFile = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/kscreen/kscreen.log";
QLoggingCategory::setFilterRules("kscreen.*=true");