log.h

Go to the documentation of this file.
00001 
00004 #ifndef __LOG_H__
00005 #define __LOG_H__
00006 
00007 #include <stdio.h>
00008 #include <stdarg.h>
00009 
00010 //#define DEBUG_GLOBAL
00011 
00012 #ifdef  DEBUG_GLOBAL
00013 static void debug_print(const char *filename, const int line, const char *funcname, char *fmt, ...) {
00014         char buf[1024];
00015         time_t t;
00016         struct tm now;
00017         va_list args;
00018 
00019         time(&t);
00020         localtime_r(&t, &now);
00021         va_start(args, fmt);
00022         printf("%d:%d:%d --- %s(%d)/%s: ", now.tm_hour, now.tm_min, now.tm_sec, filename, line, funcname);
00023         vsprintf(buf, fmt, args);
00024         printf("\t%s\n", buf);
00025         va_end(args);
00026 }
00027 #define DEBUG(x...)  debug_print(__FILE__, __LINE__, __FUNCTION__, ##x);
00028 #else
00029 #define DEBUG(x...)
00030 #endif
00031 
00032 
00033 #endif

Generated on Wed Nov 30 21:04:23 2005 for RFC Reader by  doxygen 1.4.5