summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2016-08-18 16:55:11 +0300
committerTor Lillqvist <tml@collabora.com>2016-08-18 17:02:03 +0300
commit99ee4ebb0e934413bed881a02e4634e4d3f813ea (patch)
treef69a66e39692a2ebe6da76a9d01bc9b4b1d342d9 /sal
parent4cd9e45a439b654c8e1ff7983fe7e4bd073b9c92 (diff)
If no WARN in SAL_LOG, use the INFO selection for WARNs, too
Often the choice whether some particular message is displayed with SAL_INFO or SAL_WARN has not necessarily been that well thought through. Many SAL_WARNs are not actually warnings but purely informative. If you want to see the INFOs for an area it makes sense to want to see also the WARNs for it. So make it so, unless a specific WARN selection is specified. Change-Id: I6286c5f856b29e68bedb7f20efadf56953f94b72
Diffstat (limited to 'sal')
-rw-r--r--sal/osl/all/log.cxx10
1 files changed, 7 insertions, 3 deletions
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")))
{