void _db_print(const char *format,...){
va_list args;
time_t tnow;
struct tm *tmp;
va_start(args, format);
{
tnow = time((time_t*)NULL);
tmp=localtime(&tnow);
fprintf(stderr,"%d-%02d-%02d %02d:%02d:%02d.",\
1900+tmp->tm_year,tmp->tm_mon+1,tmp->\
tm_mday,tmp->tm_hour,tmp->tm_min,tmp->tm_sec);
}
vfprintf(stderr,format, args);
va_end(args);
}
int debug_level=0;
#ifndef debug
#define debug(LEVEL) (LEVEL ? debug_level) ? (void) 0 : _db_print
#endif
#define dbgprint(format,args...) \
fprintf(stderr, format, ##args)
#define PRINTK(format, args...) {printk (KERN_ERR "%s" format, __FUNCTION__ , ## args);
#define debug(LEVEL) (LEVEL > debug_level) ? (void) 0 : _db_print
沒有留言:
張貼留言