diff options
-rw-r--r-- | sal/inc/sal/detail/log.h | 3 | ||||
-rw-r--r-- | sal/inc/sal/log.hxx | 23 | ||||
-rw-r--r-- | sal/osl/all/log.cxx | 5 |
3 files changed, 15 insertions, 16 deletions
diff --git a/sal/inc/sal/detail/log.h b/sal/inc/sal/detail/log.h index bb3d4c610f38..3787adaa74d3 100644 --- a/sal/inc/sal/detail/log.h +++ b/sal/inc/sal/detail/log.h @@ -72,8 +72,7 @@ extern "C" { enum sal_detail_LogLevel { SAL_DETAIL_LOG_LEVEL_INFO, SAL_DETAIL_LOG_LEVEL_WARN, - SAL_DETAIL_LOG_LEVEL_DEBUG, - SAL_DETAIL_MAKE_FIXED_SIZE = SAL_MAX_ENUM + SAL_DETAIL_LOG_LEVEL_DEBUG = SAL_MAX_ENUM }; SAL_DLLPUBLIC void SAL_CALL sal_detail_logFormat( diff --git a/sal/inc/sal/log.hxx b/sal/inc/sal/log.hxx index bb41a6f58e03..033edb9be17e 100644 --- a/sal/inc/sal/log.hxx +++ b/sal/inc/sal/log.hxx @@ -188,25 +188,24 @@ inline char const * unwrapStream(SAL_UNUSED_PARAMETER StreamIgnore const &) { SAL_INFO(char const * area, expr), SAL_INFO_IF(bool condition, char const * area, expr), SAL_WARN(char const * area, expr), - SAL_WARN_IF(bool condition, char const * area, expr), and - SAL_DEBUG(expr) produce an info resp. - warning log entry with a message produced by piping items into a C++ - std::ostringstream. The given expr must be so that the full expression - "stream << expr" is valid, where stream is a variable of type - std::ostringstream. + SAL_WARN_IF(bool condition, char const * area, expr), and SAL_DEBUG(expr) + produce an info, warning, or debug log entry with a message produced by + piping items into a C++ std::ostringstream. The given expr must be so that + the full expression "stream << expr" is valid, where stream is a variable of + type std::ostringstream. SAL_INFO("foo", "string " << s << " of length " << n) would be an example of such a call. - In the composed message should be in UTF-8 and it should - contain no vertical formatting characters and no null characters + The composed message should be in UTF-8 and it should contain no vertical + formatting characters and no null characters For the _IF variants, log output is only generated if the given condition is true (in addition to the other conditions that have to be met). The SAL_DEBUG macro is for temporary debug statements that are used while - working on code. It is never meant to remain in the code. It will always + working on code. It is never meant to remain in the code. It will always simply output the given expression in debug builds. For all the other macros, the given area argument must be non-null and must @@ -314,14 +313,14 @@ inline char const * unwrapStream(SAL_UNUSED_PARAMETER StreamIgnore const &) { ::SAL_DETAIL_LOG_LEVEL_WARN, area, SAL_WHERE, stream) /** - Produce temporary debugging output from stream. This macro is meant - to be used only while working on code and should never exist in production code. + Produce temporary debugging output from stream. This macro is meant to be + used only while working on code and should never exist in production code. See @ref sal_log "basic logging functionality" for details. */ #define SAL_DEBUG(stream) \ SAL_DETAIL_LOG_STREAM( \ - SAL_LOG_TRUE, ::SAL_DETAIL_LOG_LEVEL_DEBUG, NULL, SAL_WHERE, stream) + SAL_LOG_TRUE, ::SAL_DETAIL_LOG_LEVEL_DEBUG, 0, 0, stream) #endif diff --git a/sal/osl/all/log.cxx b/sal/osl/all/log.cxx index 43d704541a0b..bac0e9313919 100644 --- a/sal/osl/all/log.cxx +++ b/sal/osl/all/log.cxx @@ -156,12 +156,13 @@ void log( char const * message) { std::ostringstream s; - if (level == SAL_DETAIL_LOG_LEVEL_DEBUG) + if (level == SAL_DETAIL_LOG_LEVEL_DEBUG) { s << toString(level) << ':' << /*no where*/' ' << message << '\n'; - else + } else { s << toString(level) << ':' << area << ':' << OSL_DETAIL_GETPID << ':' << osl::Thread::getCurrentIdentifier() << ':' << where << message << '\n'; + } std::fputs(s.str().c_str(), stderr); } |