summaryrefslogtreecommitdiff
path: root/sal/osl/all
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-02-09 17:05:22 +0100
committerStephan Bergmann <sbergman@redhat.com>2017-02-09 17:05:22 +0100
commitc697ae306cd4eaa8144ed93fc908e50d5934e249 (patch)
treebe9a17514a9657a2b0f4adbc7487add3c61f2f00 /sal/osl/all
parent6e1efe7b6bd16e3183cdb7c87d786cb714a61959 (diff)
Some clean up
No more need to call sal_detail_log_report from sal_detail_log, now that it is called from SAL_DETAIL_LOG_STREAM since b3a11c8f4f307bbbb597c9c6e7e61ee93e794873 "tdf#91872: Make SAL_INFO and friends more efficient". Change-Id: Idb6cf7a4814abe29d5ba68591f39b4279267bc9b
Diffstat (limited to 'sal/osl/all')
-rw-r--r--sal/osl/all/log.cxx28
1 files changed, 7 insertions, 21 deletions
diff --git a/sal/osl/all/log.cxx b/sal/osl/all/log.cxx
index 774e7e87746c..0e15aab8f1fb 100644
--- a/sal/osl/all/log.cxx
+++ b/sal/osl/all/log.cxx
@@ -186,11 +186,9 @@ void maybeOutputTimestamp(std::ostringstream &s) {
#endif
-bool isDebug(sal_detail_LogLevel level) {
- return level == SAL_DETAIL_LOG_LEVEL_DEBUG;
}
-void log(
+void sal_detail_log(
sal_detail_LogLevel level, char const * area, char const * where,
char const * message, sal_uInt32 backtraceDepth)
{
@@ -202,13 +200,13 @@ void log(
maybeOutputTimestamp(s);
s << toString(level) << ':';
}
- if (!isDebug(level)) {
+ if (level != SAL_DETAIL_LOG_LEVEL_DEBUG) {
s << area << ':';
}
s << OSL_DETAIL_GETPID << ':';
#endif
s << osl::Thread::getCurrentIdentifier() << ':';
- if (isDebug(level)) {
+ if (level == SAL_DETAIL_LOG_LEVEL_DEBUG) {
s << ' ';
} else {
const size_t nStrLen(std::strlen(SRCDIR "/"));
@@ -216,13 +214,11 @@ void log(
+ (std::strncmp(where, SRCDIR "/", nStrLen) == 0
? nStrLen : 0));
}
-
s << message;
if (backtraceDepth != 0) {
s << " at:\n" << osl::detail::backtraceAsString(backtraceDepth);
}
s << '\n';
-
#if defined ANDROID
int android_log_level;
switch (level) {
@@ -276,17 +272,6 @@ void log(
#endif
}
-}
-
-void sal_detail_log(
- sal_detail_LogLevel level, char const * area, char const * where,
- char const * message, sal_uInt32 backtraceDepth)
-{
- if (sal_detail_log_report(level, area)) {
- log(level, area, where, message, backtraceDepth);
- }
-}
-
void sal_detail_logFormat(
sal_detail_LogLevel level, char const * area, char const * where,
char const * format, ...)
@@ -302,14 +287,15 @@ void sal_detail_logFormat(
} else if (n >= len) {
std::strcpy(buf + len - 1, "...");
}
- log(level, area, where, buf, 0);
+ sal_detail_log(level, area, where, buf, 0);
va_end(args);
}
}
-int sal_detail_log_report(enum sal_detail_LogLevel level, char const * area) {
- if (isDebug(level))
+sal_Bool sal_detail_log_report(sal_detail_LogLevel level, char const * area) {
+ if (level == SAL_DETAIL_LOG_LEVEL_DEBUG) {
return true;
+ }
assert(area != nullptr);
char const * env = getEnvironmentVariable();
if (env == nullptr) {