/usr/include/re/re_dbg.h is in libre-dev 0.4.14-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | /**
* @file re_dbg.h Interface to debugging module
*
* Copyright (C) 2010 Creytiv.com
*/
#ifdef __cplusplus
extern "C" {
#endif
/** Debug levels */
enum {
DBG_EMERG = 0, /**< System is unusable */
DBG_ALERT = 1, /**< Action must be taken immediately */
DBG_CRIT = 2, /**< Critical conditions */
DBG_ERR = 3, /**< Error conditions */
DBG_WARNING = 4, /**< Warning conditions */
DBG_NOTICE = 5, /**< Normal but significant condition */
DBG_INFO = 6, /**< Informational */
DBG_DEBUG = 7 /**< Debug-level messages */
};
/**
* @def DEBUG_MODULE
*
* Module name defined by application
*/
/**
* @def DEBUG_LEVEL
*
* Debug level defined by application
*/
#ifndef DEBUG_MODULE
# warning "DEBUG_MODULE is not defined"
#define DEBUG_MODULE "?"
#endif
#ifndef DEBUG_LEVEL
# warning "DEBUG_LEVEL is not defined"
#define DEBUG_LEVEL 7
#endif
/**
* @def DEBUG_WARNING(...)
*
* Print warning message
*/
/**
* @def DEBUG_NOTICE(...)
*
* Print notice message
*/
/**
* @def DEBUG_INFO(...)
*
* Print info message
*/
/**
* @def DEBUG_PRINTF(...)
*
* Print debug message
*/
/* Check for ISO C99 variable argument macros */
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \
|| (__GNUC__ >= 3)
#if (DEBUG_LEVEL >= 4)
#define DEBUG_WARNING(...) \
dbg_printf(DBG_WARNING, DEBUG_MODULE ": " __VA_ARGS__)
#else
#define DEBUG_WARNING(...)
#endif
#if (DEBUG_LEVEL >= 5)
#define DEBUG_NOTICE(...) \
dbg_printf(DBG_NOTICE, DEBUG_MODULE ": " __VA_ARGS__)
#else
#define DEBUG_NOTICE(...)
#endif
#if (DEBUG_LEVEL >= 6)
#define DEBUG_INFO(...) \
dbg_printf(DBG_INFO, DEBUG_MODULE ": " __VA_ARGS__)
#else
#define DEBUG_INFO(...)
#endif
#if (DEBUG_LEVEL >= 7)
#define DEBUG_PRINTF(...) \
dbg_printf(DBG_DEBUG, DEBUG_MODULE ": " __VA_ARGS__)
#else
#define DEBUG_PRINTF(...)
#endif
/* GNU extensions for variable argument macros */
#elif defined(__GNUC__)
#if (DEBUG_LEVEL >= 4)
#define DEBUG_WARNING(a...) dbg_printf(DBG_WARNING, DEBUG_MODULE ": " a)
#else
#define DEBUG_WARNING(a...)
#endif
#if (DEBUG_LEVEL >= 5)
#define DEBUG_NOTICE(a...) dbg_printf(DBG_NOTICE, DEBUG_MODULE ": " a)
#else
#define DEBUG_NOTICE(a...)
#endif
#if (DEBUG_LEVEL >= 6)
#define DEBUG_INFO(a...) dbg_printf(DBG_INFO, DEBUG_MODULE ": " a)
#else
#define DEBUG_INFO(a...)
#endif
#if (DEBUG_LEVEL >= 7)
#define DEBUG_PRINTF(a...) dbg_printf(DBG_DEBUG, DEBUG_MODULE ": " a)
#else
#define DEBUG_PRINTF(a...)
#endif
/* No variable argument macros */
#else
#if (DEBUG_LEVEL >= 4)
#define DEBUG_WARNING dbg_warning
#else
#define DEBUG_WARNING dbg_noprintf
#endif
#if (DEBUG_LEVEL >= 5)
#define DEBUG_NOTICE dbg_notice
#else
#define DEBUG_NOTICE dbg_noprintf
#endif
#if (DEBUG_LEVEL >= 6)
#define DEBUG_INFO dbg_info
#else
#define DEBUG_INFO dbg_noprintf
#endif
#if (DEBUG_LEVEL >= 7)
#define DEBUG_PRINTF dbg_noprintf
#else
#define DEBUG_PRINTF dbg_noprintf
#endif
#endif
/** Debug flags */
enum dbg_flags {
DBG_NONE = 0, /**< No debug flags */
DBG_TIME = 1<<0, /**< Print timestamp flag */
DBG_ANSI = 1<<1, /**< Print ANSI color codes */
DBG_ALL = DBG_TIME|DBG_ANSI /**< All flags enabled */
};
/**
* Defines the debug print handler
*
* @param level Debug level
* @param p Debug string
* @param len String length
* @param arg Handler argument
*/
typedef void (dbg_print_h)(int level, const char *p, size_t len, void *arg);
void dbg_init(int level, enum dbg_flags flags);
void dbg_close(void);
int dbg_logfile_set(const char *name);
void dbg_handler_set(dbg_print_h *ph, void *arg);
void dbg_printf(int level, const char *fmt, ...);
void dbg_noprintf(const char *fmt, ...);
void dbg_warning(const char *fmt, ...);
void dbg_notice(const char *fmt, ...);
void dbg_info(const char *fmt, ...);
const char *dbg_level_str(int level);
#ifdef __cplusplus
}
#endif
|