From 33cc263f2f5f8b5517c8742f6e7141cc01c75829 Mon Sep 17 00:00:00 2001 From: Bjoern Michaelsen Date: Tue, 16 Apr 2013 19:26:02 +0200 Subject: forward RTL_CONTEXT_foo logging to SAL_INFO in default debugging MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * RTL_CONTEXT_foo is originally intended to be used for performance measurement, but mostly unused right now * however its macros are sprinkled all over the codebase and might provide good help for ad-hoc debugging, and prevent SAL_INFO duplication * if there is no performance logging, these macros are now forwarded to SAL_INFO with logarea "logfile" or "$AREA.logfile" Change-Id: I495c8924e5b55124f7eac68eccda074d0740c117 Reviewed-on: https://gerrit.libreoffice.org/3421 Reviewed-by: Björn Michaelsen Tested-by: Björn Michaelsen --- sal/inc/rtl/logfile.hxx | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'sal/inc') diff --git a/sal/inc/rtl/logfile.hxx b/sal/inc/rtl/logfile.hxx index 343e8015b5e9..12b5fc78fafd 100644 --- a/sal/inc/rtl/logfile.hxx +++ b/sal/inc/rtl/logfile.hxx @@ -21,6 +21,8 @@ #include #include +#include +#include namespace rtl { @@ -161,9 +163,25 @@ namespace rtl rtl_logfile_trace( "\n" ) #else -#define RTL_LOGFILE_CONTEXT( instance, name ) ((void)0) -#define RTL_LOGFILE_CONTEXT_AUTHOR( instance, project, author, name ) ((void)0) -#define RTL_LOGFILE_CONTEXT_TRACE( instance, message ) ((void)0) +#if OSL_DEBUG_LEVEL > 0 +#define RTL_LOGFILE_FORWARD_VIA_SAL_LOG(area, message) \ + do { \ + OStringBuffer full_area; \ + full_area.append(OString(area)); \ + if(full_area.getLength()) \ + full_area.append("."); \ + full_area.append(OString("logfile")); \ + SAL_INFO(full_area.makeStringAndClear().getStr(), message); \ + } while (false) + +#else +#define RTL_LOGFILE_FORWARD_VIA_SAL_LOG(area, message) ((void)0) + +#endif + +#define RTL_LOGFILE_CONTEXT( instance, name ) RTL_LOGFILE_FORWARD_VIA_SAL_LOG("", name) +#define RTL_LOGFILE_CONTEXT_AUTHOR( instance, project, author, name ) RTL_LOGFILE_FORWARD_VIA_SAL_LOG(project, name) +#define RTL_LOGFILE_CONTEXT_TRACE( instance, message ) RTL_LOGFILE_FORWARD_VIA_SAL_LOG("", message) #define RTL_LOGFILE_CONTEXT_TRACE1( instance, frmt, arg1 ) ((void)arg1,(void)0) #define RTL_LOGFILE_CONTEXT_TRACE2( instance, frmt, arg1, arg2 ) ((void)arg1,(void)arg2,(void)0) #define RTL_LOGFILE_CONTEXT_TRACE3( instance, frmt, arg1, arg2 , arg3 ) ((void)arg1,(void)arg2,(void)arg3,(void)0) -- cgit