diff options
-rw-r--r-- | include/sal/log.hxx | 3 | ||||
-rw-r--r-- | sal/osl/all/log.cxx | 10 |
2 files changed, 10 insertions, 3 deletions
diff --git a/include/sal/log.hxx b/include/sal/log.hxx index e879a2ff71e1..8b4ef0a51962 100644 --- a/include/sal/log.hxx +++ b/include/sal/log.hxx @@ -262,6 +262,9 @@ inline char const * unwrapStream(SAL_UNUSED_PARAMETER StreamIgnore const &) { that has a sense of "+". (That is, if both +INFO.foo and -INFO.foo are present, +INFO.foo wins.) + If no WARN selection is specified, but an INFO selection is, the + INFO selection is used for WARN messages, too. + For example, if SAL_LOG is "+INFO-INFO.foo+INFO.foo.bar", then calls like SAL_INFO("foo.bar", ...), SAL_INFO("foo.bar.baz", ...), or SAL_INFO("other", ...) generate output, while calls like diff --git a/sal/osl/all/log.cxx b/sal/osl/all/log.cxx index 7f865f656857..c1608b1e3441 100644 --- a/sal/osl/all/log.cxx +++ b/sal/osl/all/log.cxx @@ -202,14 +202,17 @@ bool report(sal_detail_LogLevel level, char const * area) { // no matching switches at all, the result will be negative (and // initializing with 1 is safe as the length of a valid switch, even // without the "+"/"-" prefix, will always be > 1) + bool seenWarn = false; for (char const * p = env;;) { Sense sense; switch (*p++) { case '\0': + // if a specific item is both positive and negative + // (senseLen[POSITIVE] == senseLen[NEGATIVE]), default to + // positive + if (level == SAL_DETAIL_LOG_LEVEL_WARN && !seenWarn) + return report(SAL_DETAIL_LOG_LEVEL_INFO, area); return senseLen[POSITIVE] >= senseLen[NEGATIVE]; - // if a specific item is both positive and negative - // (senseLen[POSITIVE] == senseLen[NEGATIVE]), default to - // positive case '+': sense = POSITIVE; break; @@ -229,6 +232,7 @@ bool report(sal_detail_LogLevel level, char const * area) { } else if (equalStrings(p, p1 - p, RTL_CONSTASCII_STRINGPARAM("WARN"))) { match = level == SAL_DETAIL_LOG_LEVEL_WARN; + seenWarn = true; } else if (equalStrings(p, p1 - p, RTL_CONSTASCII_STRINGPARAM("TIMESTAMP")) || equalStrings(p, p1 - p, RTL_CONSTASCII_STRINGPARAM("RELATIVETIMER"))) { |