/* debug.h * debug macro - beta_debug(fmt, ...) * beta-song @ 2009-03-29 */ #ifndef _beta_debug_h_ #define _beta_debug_h_
/* open this switch if you want to get some debug information */ #define BETA_DEBUG
/* open this switch if you want debug information show in syslog */ #define BETA_DEBUG_SYSLOG
/* debug macros */ #ifdef BETA_DEBUG #ifdef BETA_DEBUG_SYSLOG #include <syslog.h> #define beta_debug(fmt, args...) \ ({\ openlog("[beta debug]", LOG_PID | LOG_CONS, LOG_USER);\ syslog(0, "%s->%s(), %d: "fmt"\n", __FILE__, __FUNCTION__, __LINE__, ##args);\ closelog();\ }) #else #include <stdio.h> #define beta_debug(fmt, args...) printf("[beta debug] %s->%s(), %d: "fmt"\n", __FILE__, __FUNCTION__, __LINE__, ##args) #endif #else #define beta_debug(fmt, args...) #endif
#endif /* !_beta_debug_h_ */
|