include/sal/log.hxx | 11 +++++++++++ 1 file changed, 11 insertions(+) New commits: commit c8c11b55456df5b418848ac3159b9f370215bc09 Author: Jan-Marek Glogowski <glo...@fbihome.de> AuthorDate: Sun Oct 31 02:33:46 2021 +0200 Commit: Jan-Marek Glogowski <glo...@fbihome.de> CommitDate: Mon Nov 1 12:23:38 2021 +0100
Add SAL_DEBUG_IF Change-Id: If2452cd4bad7266e7e07baaea26c58ef26ead5f5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124509 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glo...@fbihome.de> diff --git a/include/sal/log.hxx b/include/sal/log.hxx index c64ea5079c81..5faeec3113dc 100644 --- a/include/sal/log.hxx +++ b/include/sal/log.hxx @@ -385,6 +385,17 @@ inline char const * unwrapStream(SAL_UNUSED_PARAMETER StreamIgnore const &) { SAL_DETAIL_LOG_STREAM( \ SAL_LOG_TRUE, ::SAL_DETAIL_LOG_LEVEL_DEBUG, NULL, NULL, stream) +/** + Produce temporary debugging output from stream, if condition is true. 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_IF(condition, stream) \ + SAL_DETAIL_LOG_STREAM( \ + (condition), ::SAL_DETAIL_LOG_LEVEL_DEBUG, NULL, NULL, stream) + /** Produce temporary debugging output from stream along with a backtrace of the calling location.