source: branches/swt/include/dbgcon.h@ 22091

Last change on this file since 22091 was 22091, checked in by rousseau, 11 years ago

Added simple console logging

File size: 913 bytes
Line 
1/*
2 * Simple Console Logging
3 */
4
5
6#ifndef __DBGCON_H__
7#define __DBGCON_H__
8
9
10#ifdef __cplusplus
11 extern "C" {
12#endif
13
14// Comment out the #undef below to enable simple console logging.
15#undef DBG_CON
16
17#ifdef DBG_CON
18#define PFXFMT "**__con_debug(%d)** "
19#define __con_debug(lvl, fmt, ...)\
20switch (lvl) {\
21 case 0:\
22 break;\
23 case 2:\
24 printf(PFXFMT, lvl);\
25 printf(fmt, __VA_ARGS__);\
26 break;\
27 case 3:\
28 printf(PFXFMT"FUNCTION:%s ", lvl, __FUNCTION__);\
29 printf(fmt, __VA_ARGS__);\
30 break;\
31 case 4:\
32 printf(PFXFMT"FILE:%s FUNCTION:%s ", lvl, __FILE__, __FUNCTION__);\
33 printf(fmt, __VA_ARGS__);\
34 break;\
35 case 5:\
36 printf(PFXFMT, lvl);\
37 printf(fmt, __VA_ARGS__);\
38 break;\
39 default:\
40 printf(fmt, __VA_ARGS__);\
41 break;\
42}\
43fflush(stdout)
44#else
45#define __con_debug(lvl, fmt, ...)
46#endif
47
48#ifdef __cplusplus
49 }
50#endif
51
52
53#endif //__DBGCON_H__
54
Note: See TracBrowser for help on using the repository browser.