changeset 1237:b255ba44f59c

Add an option DEBUG_WITHOUT_META to strip some information from the log prefix
author Sebastien Decugis <sdecugis@freediameter.net>
date Sat, 02 Nov 2013 22:27:34 +0800
parents a0d9fb49694e
children 12c3e0c7fa0b
files include/freeDiameter/CMakeLists.txt include/freeDiameter/freeDiameter-host.h.in include/freeDiameter/libfdproto.h
diffstat 3 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/include/freeDiameter/CMakeLists.txt	Sat Sep 14 12:56:05 2013 +0200
+++ b/include/freeDiameter/CMakeLists.txt	Sat Nov 02 22:27:34 2013 +0800
@@ -15,6 +15,9 @@
 # Find TODO items in the code easily ?
 OPTION(ERRORS_ON_TODO "(development) Generate compilation errors on TODO items ?" OFF)
 
+# In DEBUG mode, each log contains pid, calling function and file for easy debug. Set to ON to strip this information.
+OPTION(DEBUG_WITHOUT_META "Strip calling location in logs?" OFF)
+	
 # Create the absolute path for searching extensions
 SET(DEFAULT_EXTENSIONS_PATH ${CMAKE_INSTALL_PREFIX}/${INSTALL_EXTENSIONS_SUFFIX})
 
@@ -33,7 +36,7 @@
 # compliancy of their implementation with the Diameter RFC...
 OPTION(WORKAROUND_ACCEPT_INVALID_VSAI "Do not reject a CER/CEA with a Vendor-Specific-Application-Id AVP containing both Auth- and Acct- application AVPs?" OFF)
 
-MARK_AS_ADVANCED(DISABLE_SCTP DEBUG_SCTP SCTP_USE_MAPPED_ADDRESSES ERRORS_ON_TODO DIAMID_IDNA_IGNORE DIAMID_IDNA_REJECT DISABLE_PEER_EXPIRY WORKAROUND_ACCEPT_INVALID_VSAI)
+MARK_AS_ADVANCED(DISABLE_SCTP DEBUG_SCTP SCTP_USE_MAPPED_ADDRESSES ERRORS_ON_TODO DEBUG_WITHOUT_META DIAMID_IDNA_IGNORE DIAMID_IDNA_REJECT DISABLE_PEER_EXPIRY WORKAROUND_ACCEPT_INVALID_VSAI)
 
 ########################
 ### System checks part
--- a/include/freeDiameter/freeDiameter-host.h.in	Sat Sep 14 12:56:05 2013 +0200
+++ b/include/freeDiameter/freeDiameter-host.h.in	Sat Nov 02 22:27:34 2013 +0800
@@ -53,6 +53,7 @@
 
 #cmakedefine DISABLE_SCTP
 #cmakedefine DEBUG_SCTP
+#cmakedefine DEBUG_WITHOUT_META
 #cmakedefine SCTP_USE_MAPPED_ADDRESSES
 #cmakedefine SCTP_CONNECTX_4_ARGS
 #cmakedefine SKIP_DLCLOSE
--- a/include/freeDiameter/libfdproto.h	Sat Sep 14 12:56:05 2013 +0200
+++ b/include/freeDiameter/libfdproto.h	Sat Nov 02 22:27:34 2013 +0800
@@ -295,13 +295,13 @@
 
 
 /* In DEBUG mode, we add meta-information along each trace. This makes multi-threading problems easier to debug. */
-#ifdef DEBUG
+#if (defined(DEBUG) && !defined(DEBUG_WITHOUT_META))
 # define STD_TRACE_FMT_STRING "pid:%s in %s@%s:%d: "
 # define STD_TRACE_FMT_ARGS   , ((char *)pthread_getspecific(fd_log_thname) ?: "unnamed"), __PRETTY_FUNCTION__, __STRIPPED_FILE__, __LINE__
-#else /* DEBUG */
+#else /* DEBUG && !DEBUG_WITHOUT_META */
 # define STD_TRACE_FMT_STRING ""
 # define STD_TRACE_FMT_ARGS
-#endif /* DEBUG */
+#endif /* DEBUG && !DEBUG_WITHOUT_META */
 
 /*************************
   The general debug macro
"Welcome to our mercurial repository"