diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2016-01-12 21:50:34 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2016-01-12 23:47:36 +0000 |
commit | c995196ff0e9f7041b03fc513d703d6e60b8c867 (patch) | |
tree | f848e489d376acbe8246acce5fc5964070ce02c9 | |
parent | 40f9ae367ca71e9dadb7cd76b08616b229726d7e (diff) |
Fixup SAL_DEBUG_TRACE macro.
Change-Id: I276ce9a356086001c208902ba94641863c2f2fdb
Reviewed-on: https://gerrit.libreoffice.org/21408
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
-rw-r--r-- | sal/osl/all/log.cxx | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/sal/osl/all/log.cxx b/sal/osl/all/log.cxx index a343403490bd..665942b27c9b 100644 --- a/sal/osl/all/log.cxx +++ b/sal/osl/all/log.cxx @@ -107,8 +107,15 @@ char const * getEnvironmentVariable() { #endif +namespace { + inline bool isDebug(sal_detail_LogLevel level) { + return level == SAL_DETAIL_LOG_LEVEL_DEBUG || + level == SAL_DETAIL_LOG_LEVEL_DEBUG_TRACE; + } +} + bool report(sal_detail_LogLevel level, char const * area) { - if (level == SAL_DETAIL_LOG_LEVEL_DEBUG) + if (isDebug(level)) return true; assert(area != nullptr); char const * env = getEnvironmentVariable(); @@ -187,13 +194,13 @@ void log( if (!sal_use_syslog) { s << toString(level) << ':'; } - if (level != SAL_DETAIL_LOG_LEVEL_DEBUG) { + if (!isDebug(level)) { s << area << ':'; } s << OSL_DETAIL_GETPID << ':'; #endif s << osl::Thread::getCurrentIdentifier() << ':'; - if (level == SAL_DETAIL_LOG_LEVEL_DEBUG) { + if (isDebug(level)) { s << ' '; } else { const size_t nStrLen(std::strlen(SRCDIR "/")); @@ -203,7 +210,7 @@ void log( } s << message; - if (level == SAL_DETAIL_LOG_LEVEL_DEBUG_TRACE) { + if (isDebug(level)) { s << " at:\n"; s << OUString(osl_backtraceAsString(), SAL_NO_ACQUIRE); } @@ -219,6 +226,7 @@ void log( android_log_level = ANDROID_LOG_WARN; break; case SAL_DETAIL_LOG_LEVEL_DEBUG: + case SAL_DETAIL_LOG_LEVEL_DEBUG_TRACE: android_log_level = ANDROID_LOG_DEBUG; break; default: @@ -243,6 +251,7 @@ void log( prio = LOG_WARNING; break; case SAL_DETAIL_LOG_LEVEL_DEBUG: + case SAL_DETAIL_LOG_LEVEL_DEBUG_TRACE: prio = LOG_DEBUG; break; } |