aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'dce_priv.h')
-rw-r--r--dce_priv.h38
1 files changed, 23 insertions, 15 deletions
diff --git a/dce_priv.h b/dce_priv.h
index 7f2624f..70ee4c5 100644
--- a/dce_priv.h
+++ b/dce_priv.h
@@ -33,28 +33,36 @@
33#ifndef __DCE_PRIV_H__ 33#ifndef __DCE_PRIV_H__
34#define __DCE_PRIV_H__ 34#define __DCE_PRIV_H__
35 35
36 36extern int dce_debug;
37#ifdef BUILDOS_QNX
38#include <sys/slog.h>
39
40 37
41/********************* MACROS ************************/ 38/********************* MACROS ************************/
42/***************** TRACE MACROS *********************/ 39/***************** TRACE MACROS *********************/
43/* Need to make it OS specific and support different trace levels */ 40/* Need to make it OS specific and support different trace levels */
44#define ERROR(FMT, ...) do { \ 41
42/* set desired trace level:
43 * 1 - error
44 * 2 - error, debug
45 * 3 - error, debug, info (very verbose)
46 */
47#ifdef DCE_DEBUG_ENABLE
48#define ERROR(FMT,...) TRACE(1, "ERROR: " FMT, ##__VA_ARGS__)
49#define DEBUG(FMT,...) TRACE(2, "DEBUG: " FMT, ##__VA_ARGS__)
50#define INFO(FMT,...) TRACE(3, "INFO: " FMT, ##__VA_ARGS__)
51#else
52#define ERROR(FMT,...)
53#define DEBUG(FMT,...)
54#define INFO(FMT,...)
55#endif
56
57#ifdef BUILDOS_QNX
58#include <sys/slog.h>
59#define TRACE(lvl,FMT, ...) do if ((lvl) <= dce_debug) { \
45 slogf(42, _SLOG_INFO, "%s:%d:\t%s\terror: " FMT, __FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__); \ 60 slogf(42, _SLOG_INFO, "%s:%d:\t%s\terror: " FMT, __FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__); \
46} while( 0 ) 61} while( 0 )
47#define DEBUG(FMT, ...) do { \
48 slogf(42, _SLOG_DEBUG2, "%s:%d:\t%s\tdebug: " FMT, __FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__); \
49} while( 0 )
50#endif
51 62
52#ifdef BUILDOS_LINUX 63#elif defined BUILDOS_LINUX
53#define ERROR(FMT, ...) do { \ 64#define TRACE(lvl,FMT, ...) do if ((lvl) <= dce_debug) { \
54 printf("%s:%d:\t%s\t Error: "FMT,__FILE__, __LINE__,__FUNCTION__ ,##__VA_ARGS__); \ 65 printf("%s:%d:\t%s\t Error: "FMT,__FILE__, __LINE__,__FUNCTION__ ,##__VA_ARGS__); \
55}while( 0 )
56#define DEBUG(FMT, ...) do { \
57 printf("%s:%d:\t%s\t Debug: "FMT,__FILE__, __LINE__,__FUNCTION__ ,##__VA_ARGS__); \
58}while( 0 ) 66}while( 0 )
59#endif 67#endif
60 68