00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _ARDEV_DEBUG_H
00021 #define _ARDEV_DEBUG_H
00022
00023 #include <ardev/ardev.h>
00024 #include <stdarg.h>
00025 #include <assert.h>
00026
00027
00028 const int ARDBG_THREAD = 6;
00029 const int ARDBG_VERBOSE = 5;
00030 const int ARDBG_INFO = 3;
00031 const int ARDBG_WARN = 2;
00032 const int ARDBG_ERR = 1;
00033
00034
00035
00036 #ifdef DEBUG
00037 inline void dbg_print(int Level, const char* format, ...)
00038 {
00039 va_list ap;
00040 va_start(ap,format);
00041
00042 if (Level <= ARDev::DebugLevel)
00043 {
00044 fprintf(stderr,"%X: ",(int) pthread_self());
00045 vfprintf(stderr,format, ap);
00046 fflush(stderr);
00047 }
00048 va_end(ap);
00049
00050 };
00051 #else
00052 inline void dbg_print(int Level, const char* format, ...)
00053 {
00054 };
00055 #endif
00056
00057
00058 #endif