diff options
author | Kai Koehne <kai.koehne@digia.com> | 2014-03-11 17:04:28 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-13 13:26:51 +0100 |
commit | ef43967fcd7a0d8f9cf176dcc3f09a2970fd570d (patch) | |
tree | 36d771bee57e581aecc54a5636b55e28525cdfcf /src/corelib/io/qloggingregistry.cpp | |
parent | 490298e93901eac0eba8c1156e9f9d6f2ccb6b11 (diff) |
Logging: Let user configure rules via QT_LOGGING_RULES
Check also for rules set in an environment variable QT_LOGGING_RULES.
This makes it even more convenient to set rules e.g. for just one run of an
application, without having to create a logging configuration file. It
is also more in place with the current way we enable/disable debugging
of parts of Qt via environment variables.
Change-Id: I4d05976f2b6c12bca472552ffa22345475cd01de
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Reviewed-by: Tomasz Olszak <olszak.tomasz@gmail.com>
Diffstat (limited to 'src/corelib/io/qloggingregistry.cpp')
-rw-r--r-- | src/corelib/io/qloggingregistry.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/corelib/io/qloggingregistry.cpp b/src/corelib/io/qloggingregistry.cpp index 6e195d29cb..23f1ffbd16 100644 --- a/src/corelib/io/qloggingregistry.cpp +++ b/src/corelib/io/qloggingregistry.cpp @@ -248,7 +248,7 @@ static bool qtLoggingDebug() /*! \internal Initializes the rules database by loading - .config/QtProject/qtlogging.ini and $QT_LOGGING_CONF. + $QT_LOGGING_CONF, $QT_LOGGING_RULES, and .config/QtProject/qtlogging.ini. */ void QLoggingRegistry::init() { @@ -266,6 +266,14 @@ void QLoggingRegistry::init() envRules = parser.rules(); } } + const QByteArray rulesSrc = qgetenv("QT_LOGGING_RULES"); + if (!rulesSrc.isEmpty()) { + QTextStream stream(rulesSrc); + QLoggingSettingsParser parser; + parser.setSection(QStringLiteral("Rules")); + parser.setContent(stream); + envRules += parser.rules(); + } // get rules from qt configuration QString envPath = QStandardPaths::locate(QStandardPaths::GenericConfigLocation, |