Mercurial > hg > freeDiameter
diff include/freeDiameter/libfdproto.h @ 1134:51ce5a30df2d
Fix the dbg_func and dbg_file parameters
author | Sebastien Decugis <sdecugis@freediameter.net> |
---|---|
date | Wed, 15 May 2013 15:41:48 +0800 |
parents | d4371b7aa0ff |
children | 05f74dc19c49 |
line wrap: on
line diff
--- a/include/freeDiameter/libfdproto.h Wed May 15 12:30:49 2013 +0800 +++ b/include/freeDiameter/libfdproto.h Wed May 15 15:41:48 2013 +0800 @@ -456,12 +456,16 @@ CALL = 9 } MARK_DEPRECATED; -static __inline__ int TRACE_BOOL( enum old_levels level ) MARK_DEPRECATED -{ - return (level <= fd_g_debug_lvl) - || (fd_debug_one_function && !strcmp(fd_debug_one_function, __PRETTY_FUNCTION__)) - || (fd_debug_one_file && !strcmp(fd_debug_one_file, __STRIPPED_FILE__) ); +static __inline__ int old_TRACE_BOOL( enum old_levels level, const char * file, const char * func ) MARK_DEPRECATED +{ + if ((fd_debug_one_function && !strcmp(fd_debug_one_function, func)) + || (fd_debug_one_file && !strcmp(fd_debug_one_file, file) )) + return 2; /* Level override */ + if (level <= fd_g_debug_lvl) + return 1; /* Normal level */ + return 0; /* No trace */ } +#define TRACE_BOOL(level) old_TRACE_BOOL((level), __STRIPPED_FILE__, __PRETTY_FUNCTION__) #ifndef SWIG static __inline__ void fd_log_deprecated( int level, const char *format, ... ) MARK_DEPRECATED @@ -487,9 +491,11 @@ /* old macro for traces. To be replaced by appropriate LOG_* macros. */ # define TRACE_DEBUG(oldlevel, format,args... ) { \ - if (TRACE_BOOL(oldlevel)) { \ + int __l__; \ + if ((__l__ = TRACE_BOOL(oldlevel))) { \ if (oldlevel <= NONE) { LOG_E(format,##args); } \ else if (oldlevel <= INFO) { LOG_N(format,##args); } \ + else if (__l__ == 2) { LOG_N(format,##args); } \ else if (oldlevel <= FULL) { LOG_D(format,##args); } \ else { LOG_A(format,##args); } \ } }