changeset 302:d46b454ccc33

Simplify traces format in case of non Debug configuration
author Sebastien Decugis <sdecugis@nict.go.jp>
date Thu, 13 May 2010 17:25:27 +0900
parents e7f283c06ffc
children 32ba9cf7ba87
files include/freeDiameter/libfreeDiameter.h
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/include/freeDiameter/libfreeDiameter.h	Thu May 13 17:13:47 2010 +0900
+++ b/include/freeDiameter/libfreeDiameter.h	Thu May 13 17:25:27 2010 +0900
@@ -210,6 +210,8 @@
 /*************
  The general debug macro, each call results in two lines of debug messages (change the macro for more compact output) 
  *************/
+#ifdef DEBUG
+/* In DEBUG mode, we add (a lot of) meta-information along each trace. This makes multi-threading problems easier to debug. */
 #define TRACE_DEBUG(level,format,args... ) {											\
 	if ( TRACE_BOOL(level) ) {												\
 		char __buf[25];													\
@@ -220,6 +222,14 @@
 					(level < FULL)?"@":" ",level, "", ## args); 						\
 	}															\
 }
+#else /* DEBUG */
+/* Do not print thread, function, ... only the message itself in this case. */
+#define TRACE_DEBUG(level,format,args... ) {		\
+	if ( TRACE_BOOL(level) ) {			\
+		fd_log_debug(format "\n", ## args); 	\
+	}						\
+}
+#endif /* DEBUG */
 
 /*************
  Derivatives from this macro 
"Welcome to our mercurial repository"