32 lines
614 B
C
32 lines
614 B
C
#ifndef INSDBG_H_INCLUDED
|
|
#define INSDBG_H_INCLUDED
|
|
|
|
#ifdef NODEBUG
|
|
|
|
#define DBG_Log(level, fmt, v...)
|
|
|
|
#else
|
|
|
|
#ifndef DBG_LEVEL
|
|
#define DBG_LEVEL DBG_INFO
|
|
#endif // DBG_LEVEL
|
|
|
|
#ifndef DBG_TAG
|
|
#define DBG_TAG " "
|
|
#endif // DBG_TAG
|
|
|
|
#include <time.h>
|
|
inline unsigned long get_startup_ms(void) {
|
|
return (unsigned long)(clock() * 10000 / CLOCKS_PER_SEC);
|
|
}
|
|
//#define DBG_Log(level, fmt, v...)
|
|
#define DBG_Log(level, fmt, v...) \
|
|
do { \
|
|
if (level >= DBG_LEVEL) \
|
|
printf("[%lu][ %15s ] " fmt, get_startup_ms(), DBG_TAG, ##v); \
|
|
} while(0)
|
|
|
|
#endif // NODEBUG
|
|
|
|
#endif // INSDBG_H_INCLUDED
|