44 #define CX_LOG_LEVEL_USER_SHIFT (8)
54 CX_LOG_FLAG_RECURSION = 1 << 0,
55 CX_LOG_FLAG_FATAL = 1 << 1,
58 CX_LOG_LEVEL_ERROR = 1 << 2,
59 CX_LOG_LEVEL_CRITICAL = 1 << 3,
60 CX_LOG_LEVEL_WARNING = 1 << 4,
61 CX_LOG_LEVEL_MESSAGE = 1 << 5,
62 CX_LOG_LEVEL_INFO = 1 << 6,
63 CX_LOG_LEVEL_DEBUG = 1 << 7,
65 CX_LOG_LEVEL_MASK = ~(CX_LOG_FLAG_RECURSION | CX_LOG_FLAG_FATAL)
68 #define CX_LOG_FATAL_MASK (CX_LOG_FLAG_RECURSION | CX_LOG_LEVEL_ERROR)
75 typedef void (*cx_log_func) (
const cxchar *, cx_log_level_flags,
76 const cxchar *, cxptr);
77 typedef void (*cx_print_func) (
const cxchar *);
85 const cxchar *, cxptr);
97 void cx_log(
const cxchar *, cx_log_level_flags,
98 const cxchar *, ...) CX_GNUC_PRINTF(3, 4);
99 void cx_logv(const cxchar *, cx_log_level_flags,
100 const cxchar *, va_list) CX_GNUC_PRINTF(3, 0);
105 void cx_print(const cxchar *, ...) CX_GNUC_PRINTF(1, 2);
106 void cx_printerr(const cxchar *, ...) CX_GNUC_PRINTF(1, 0);
113 void cx_error(const cxchar *, ...) CX_GNUC_PRINTF(1, 2);
114 void cx_critical(const cxchar *, ...) CX_GNUC_PRINTF(1, 2);
115 void cx_warning(const cxchar *, ...) CX_GNUC_PRINTF(1, 2);
116 void cx_message(const cxchar *, ...) CX_GNUC_PRINTF(1, 2);
119 #ifndef CX_LOG_DOMAIN
120 # define CX_LOG_DOMAIN ((cxchar *)0)
128 #ifdef CX_DISABLE_ASSERT
130 # define cx_assert(expr)
135 # define cx_assert(expr) \
141 cx_log(CX_LOG_DOMAIN, CX_LOG_LEVEL_ERROR, \
142 "file %s: line %d (%s): assertion failed: (%s)", \
143 __FILE__, __LINE__, __PRETTY_FUNCTION__, #expr); \
147 # define cx_assert(expr) \
153 cx_log(CX_LOG_DOMAIN,CX_LOG_LEVEL_ERROR, \
154 "file %s: line %d: assertion failed: (%s)", \
155 __FILE__, __LINE__, #expr); \