comparison include/freeDiameter/libfreeDiameter.h @ 174:2b2f78036749

Added simple command-line switch to turn on full debug for specific function or file
author Sebastien Decugis <sdecugis@nict.go.jp>
date Wed, 03 Feb 2010 15:58:56 +0900
parents 6db078b955e3
children 0ea50d66ad1b
comparison
equal deleted inserted replaced
173:4c0f358b8982 174:2b2f78036749
95 * RETURN VALUE: 95 * RETURN VALUE:
96 * None. 96 * None.
97 */ 97 */
98 void fd_log_debug ( char * format, ... ); 98 void fd_log_debug ( char * format, ... );
99 extern pthread_mutex_t fd_log_lock; 99 extern pthread_mutex_t fd_log_lock;
100 extern char * fd_debug_one_function;
101 extern char * fd_debug_one_file;
100 102
101 /* 103 /*
102 * FUNCTION: fd_log_threadname 104 * FUNCTION: fd_log_threadname
103 * 105 *
104 * PARAMETERS: 106 * PARAMETERS:
163 #ifndef __PRETTY_FUNCTION__ 165 #ifndef __PRETTY_FUNCTION__
164 #define __PRETTY_FUNCTION__ __func__ 166 #define __PRETTY_FUNCTION__ __func__
165 #endif /* __PRETTY_FUNCTION__ */ 167 #endif /* __PRETTY_FUNCTION__ */
166 168
167 /* Boolean for tracing at a certain level */ 169 /* Boolean for tracing at a certain level */
168 #define TRACE_BOOL(_level_) ( (_level_) <= local_debug_level + fd_g_debug_lvl ) 170 #define TRACE_BOOL(_level_) ( ((_level_) <= local_debug_level + fd_g_debug_lvl) \
171 || (fd_debug_one_function && !strcmp(fd_debug_one_function, __PRETTY_FUNCTION__)) \
172 || (fd_debug_one_file && !strcmp(fd_debug_one_file, __FILE__) ) )
169 173
170 /* The general debug macro, each call results in two lines of debug messages (change the macro for more compact output) */ 174 /* The general debug macro, each call results in two lines of debug messages (change the macro for more compact output) */
171 #define TRACE_DEBUG(level,format,args... ) { \ 175 #define TRACE_DEBUG(level,format,args... ) { \
172 if ( TRACE_BOOL(level) ) { \ 176 if ( TRACE_BOOL(level) ) { \
173 char __buf[25]; \ 177 char __buf[25]; \
"Welcome to our mercurial repository"