Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
debug.h File Reference
#include <sys/time.h>
#include <time.h>
Include dependency graph for debug.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ANSI_RED   ""
 
#define ANSI_GREEN   ""
 
#define ANSI_YELLOW   ""
 
#define ANSI_BLUE   ""
 
#define ANSI_MAGENTA   ""
 
#define ANSI_CYAN   ""
 
#define ANSI_RESET   ""
 
#define __FILENAME__    (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
 
#define D(var, file, col, who, lev, ...)
 
#define DLN(var, file, col, who, lev, ...)
 

Macro Definition Documentation

◆ __FILENAME__

#define __FILENAME__    (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)

Definition at line 41 of file debug.h.

41#define __FILENAME__ \
42 (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)

◆ ANSI_BLUE

#define ANSI_BLUE   ""

Definition at line 35 of file debug.h.

◆ ANSI_CYAN

#define ANSI_CYAN   ""

Definition at line 37 of file debug.h.

◆ ANSI_GREEN

#define ANSI_GREEN   ""

Definition at line 33 of file debug.h.

◆ ANSI_MAGENTA

#define ANSI_MAGENTA   ""

Definition at line 36 of file debug.h.

◆ ANSI_RED

#define ANSI_RED   ""

Definition at line 32 of file debug.h.

◆ ANSI_RESET

#define ANSI_RESET   ""

Definition at line 38 of file debug.h.

◆ ANSI_YELLOW

#define ANSI_YELLOW   ""

Definition at line 34 of file debug.h.

◆ D

#define D ( var,
file,
col,
who,
lev,
... )
Value:
if (var) { \
struct timeval _tv; \
struct tm _tm; \
char _tbuf[20]; \
time_t _tsecs; \
gettimeofday(&_tv, NULL); \
_tsecs = _tv.tv_sec; \
localtime_r(&_tsecs, &_tm); \
strftime(_tbuf, 20, "%H:%M:%S", &_tm); \
fprintf(file, "[" col who " - " lev ANSI_RESET " %s.%06ld] ", _tbuf, \
(long) _tv.tv_usec); \
fprintf(file, "%s:%d (%s): ", __FILENAME__, __LINE__, __func__); \
fprintf(file, __VA_ARGS__); \
}
#define __FILENAME__
Definition debug.h:41
#define ANSI_RESET
Definition debug.h:38
#define __func__

Definition at line 44 of file debug.h.

44#define D(var, file, col, who, lev, ...) \
45 if (var) { \
46 struct timeval _tv; \
47 struct tm _tm; \
48 char _tbuf[20]; \
49 time_t _tsecs; \
50 gettimeofday(&_tv, NULL); \
51 _tsecs = _tv.tv_sec; \
52 localtime_r(&_tsecs, &_tm); \
53 strftime(_tbuf, 20, "%H:%M:%S", &_tm); \
54 fprintf(file, "[" col who " - " lev ANSI_RESET " %s.%06ld] ", _tbuf, \
55 (long) _tv.tv_usec); \
56 fprintf(file, "%s:%d (%s): ", __FILENAME__, __LINE__, __func__); \
57 fprintf(file, __VA_ARGS__); \
58 }

◆ DLN

#define DLN ( var,
file,
col,
who,
lev,
... )
Value:
if (var) { \
D(var, file, col, who, lev, __VA_ARGS__); \
fprintf(file, "\n"); \
}

Definition at line 60 of file debug.h.

60#define DLN(var, file, col, who, lev, ...) \
61 if (var) { \
62 D(var, file, col, who, lev, __VA_ARGS__); \
63 fprintf(file, "\n"); \
64 }