C...static const char STR_MODULENAME[] = "Test:";......#define TRACE(strings) \{ \ printf(STR_MODULENAME); \ printf(__FUNCTION__); \ printf##strings; \}...
C#define TRACE(strings) printf(STR_MODULENAME); printf(__FUNCTION__); printf(strings);
C#ifndef TRACE_H#define TRACE_H #include <stdio.h> enum { INFO_LEVEL = 0x01, ERR_LEVEL = 0x02}; int levels = INFO_LEVEL | ERR_LEVEL; #define TRACE(level,strings) \ if ((level) & levels) \{ \ printf(STR_MODULENAME); \ printf(__FUNCTION__); \ printf##strings; \} #endif // TRACE_H
Cstatic const char STR_MODULENAME[] = "Test:"; #include <trace.h> int main(int argc, char *argv[]){ TRACE(INFO_LEVEL, ("Im is INFO trace %d\n\r", 12345)); return 0;}
Cprintf("Im is INFO trace %d\n\r", 12345);
C++ (Qt)#define TRACE(format, ...) printf(("%s %s " format), STR_MODULENAME, __FUNCTION__, ##__VA_ARGS__)
CTRACE("i'm trace %d", 123);
C#ifndef TRACE_H#define TRACE_H #include <stdio.h> enum { INFO_LEVEL = 0x01, ERR_LEVEL = 0x02}; int levels = INFO_LEVEL | ERR_LEVEL; #define ENDL "\n\r" #define TRACE(level, format, ...) \ if ((level) & levels) \{ \ printf(("%s:%s: " format), STR_MODULENAME, __FUNCTION__, ##__VA_ARGS__); \ printf(ENDL); \} #endif // TRACE_H
C...TRACE(INFO_LEVEL, "Im is INFO trace %d %s", 12345, "-string");...
C...TRACE(INFO_LEVEL, ("Im is INFO trace %d %s", 12345, "-string"));...