Kaydet (Commit) c697ae30 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

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 b3a11c8f
"tdf#91872: Make SAL_INFO and friends more efficient".

Change-Id: Idb6cf7a4814abe29d5ba68591f39b4279267bc9b
üst 6e1efe7b
......@@ -27,11 +27,11 @@
/// @cond INTERNAL
extern "C" SAL_DLLPUBLIC void SAL_CALL sal_detail_log(
enum sal_detail_LogLevel level, char const * area, char const * where,
sal_detail_LogLevel level, char const * area, char const * where,
char const * message, sal_uInt32 backtraceDepth);
extern "C" SAL_DLLPUBLIC int SAL_CALL sal_detail_log_report(
enum sal_detail_LogLevel level, char const * area);
extern "C" SAL_DLLPUBLIC sal_Bool SAL_CALL sal_detail_log_report(
sal_detail_LogLevel level, char const * area);
namespace sal { namespace detail {
......
......@@ -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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment