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 /tests/auto/corelib/io/qloggingregistry | |
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 'tests/auto/corelib/io/qloggingregistry')
-rw-r--r-- | tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp b/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp index ba53df03b6..4318396bd4 100644 --- a/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp +++ b/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp @@ -64,6 +64,7 @@ private slots: // ensure a clean environment QStandardPaths::setTestModeEnabled(true); qunsetenv("QT_LOGGING_CONF"); + qunsetenv("QT_LOGGING_RULES"); } void QLoggingRule_parse_data() @@ -219,6 +220,13 @@ private slots: QCOMPARE(registry.envRules.size(), 1); QCOMPARE(registry.rules.size(), 1); + + // check that QT_LOGGING_RULES take precedence + qputenv("QT_LOGGING_RULES", "Digia.*=true"); + registry.init(); + QCOMPARE(registry.envRules.size(), 2); + QCOMPARE(registry.envRules.at(1).enabled, true); + QCOMPARE(registry.rules.size(), 2); } void QLoggingRegistry_config() |