|
0
|
1 |
#ifndef _DebugH_
|
|
|
2 |
#define _DebugH_ 1
|
|
|
3 |
|
|
|
4 |
class DebugC { // independent utility staff
|
|
|
5 |
public:
|
|
|
6 |
static int debug; // debug log level
|
|
|
7 |
static char *prg_name; // not used at the moment
|
|
|
8 |
static long int t0;
|
|
|
9 |
static sem_t semaphore; // semafor for log timestamping
|
|
|
10 |
static sem_t *semP; // -->semafor for log timestamping
|
|
|
11 |
static void debug_init(char *prgname);
|
|
|
12 |
|
|
|
13 |
char s[256]; // debug msg workspace
|
|
|
14 |
char debid[128]; // debug ID of process
|
|
|
15 |
|
|
|
16 |
void pre(char *o);
|
|
|
17 |
void deb(int level);
|
|
|
18 |
void err(int level, char *o);
|
|
|
19 |
void back_trace();
|
|
|
20 |
};
|
|
|
21 |
typedef DebugC *DebugP;
|
|
|
22 |
|
|
|
23 |
#define DEBID(...) sprintf(deP->debid, __VA_ARGS__)
|
|
|
24 |
#define LOG(level, ...) sprintf(deP->s, __VA_ARGS__), deP->deb(level)
|
|
|
25 |
#endif
|