diff options
author | Luboš Luňák <l.lunak@suse.cz> | 2012-04-03 17:14:43 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@suse.cz> | 2012-04-03 18:16:38 +0200 |
commit | f46775a206589fb9486833ae2e043731cb6be54f (patch) | |
tree | 8ef070fe4e6b1cb8a66fd02bd22b1c515ba2f9eb /sal/inc | |
parent | f4e0cbaa15c2861e87149a62c9c80a9e9b4094b3 (diff) |
SAL_DEBUG(), instead of those temporary debug printf's
Diffstat (limited to 'sal/inc')
-rw-r--r-- | sal/inc/sal/detail/log.h | 1 | ||||
-rw-r--r-- | sal/inc/sal/log.hxx | 21 |
2 files changed, 19 insertions, 3 deletions
diff --git a/sal/inc/sal/detail/log.h b/sal/inc/sal/detail/log.h index 6ed6a1d95cb8..bb3d4c610f38 100644 --- a/sal/inc/sal/detail/log.h +++ b/sal/inc/sal/detail/log.h @@ -72,6 +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 }; diff --git a/sal/inc/sal/log.hxx b/sal/inc/sal/log.hxx index 6a2a17c81a1c..59c11cd02713 100644 --- a/sal/inc/sal/log.hxx +++ b/sal/inc/sal/log.hxx @@ -187,8 +187,9 @@ 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), and - SAL_WARN_IF(bool condition, char const * area, expr) produce an info resp. + 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 @@ -208,7 +209,11 @@ inline char const * unwrapStream(SAL_UNUSED_PARAMETER StreamIgnore const &) { 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). - For all these macros, the given area argument must be non-null and must + 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 + simply output the given expression in debug builds. + + For all the other macros, the given area argument must be non-null and must match the regular expression <area> ::= <segment>("."<segment>)* @@ -312,6 +317,16 @@ inline char const * unwrapStream(SAL_UNUSED_PARAMETER StreamIgnore const &) { SAL_DETAIL_ENABLE_LOG_WARN && (condition), \ ::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. + + 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) + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |