[Libreoffice-commits] core.git: sal/osl
Michael Meeks
michael.meeks at collabora.com
Tue Jan 12 15:48:00 PST 2016
sal/osl/all/log.cxx | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
New commits:
commit c995196ff0e9f7041b03fc513d703d6e60b8c867
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Tue Jan 12 21:50:34 2016 +0000
Fixup SAL_DEBUG_TRACE macro.
Change-Id: I276ce9a356086001c208902ba94641863c2f2fdb
Reviewed-on: https://gerrit.libreoffice.org/21408
Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
Tested-by: Michael Meeks <michael.meeks at collabora.com>
diff --git a/sal/osl/all/log.cxx b/sal/osl/all/log.cxx
index a343403..665942b 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;
}
More information about the Libreoffice-commits
mailing list