36 #define CX_LOG_LEVEL_USER_SHIFT (8)
46 CX_LOG_FLAG_RECURSION = 1 << 0,
47 CX_LOG_FLAG_FATAL = 1 << 1,
50 CX_LOG_LEVEL_ERROR = 1 << 2,
51 CX_LOG_LEVEL_CRITICAL = 1 << 3,
52 CX_LOG_LEVEL_WARNING = 1 << 4,
53 CX_LOG_LEVEL_MESSAGE = 1 << 5,
54 CX_LOG_LEVEL_INFO = 1 << 6,
55 CX_LOG_LEVEL_DEBUG = 1 << 7,
57 CX_LOG_LEVEL_MASK = ~(CX_LOG_FLAG_RECURSION | CX_LOG_FLAG_FATAL)
60 #define CX_LOG_FATAL_MASK (CX_LOG_FLAG_RECURSION | CX_LOG_LEVEL_ERROR)
67 typedef void (*cx_log_func) (
const cxchar *, cx_log_level_flags,
68 const cxchar *, cxptr);
69 typedef void (*cx_print_func) (
const cxchar *);
77 const cxchar *, cxptr);
89 void cx_log(
const cxchar *, cx_log_level_flags,
90 const cxchar *, ...) CX_GNUC_PRINTF(3, 4);
91 void cx_logv(const cxchar *, cx_log_level_flags,
92 const cxchar *, va_list) CX_GNUC_PRINTF(3, 0);
97 void cx_print(const cxchar *, ...) CX_GNUC_PRINTF(1, 2);
98 void cx_printerr(const cxchar *, ...) CX_GNUC_PRINTF(1, 0);
105 void cx_error(const cxchar *, ...) CX_GNUC_PRINTF(1, 2);
106 void cx_critical(const cxchar *, ...) CX_GNUC_PRINTF(1, 2);
107 void cx_warning(const cxchar *, ...) CX_GNUC_PRINTF(1, 2);
108 void cx_message(const cxchar *, ...) CX_GNUC_PRINTF(1, 2);
111 #ifndef CX_LOG_DOMAIN
112 # define CX_LOG_DOMAIN ((cxchar *)0)
120 #ifdef CX_DISABLE_ASSERT
122 # define cx_assert(expr)
127 # define cx_assert(expr) \
133 cx_log(CX_LOG_DOMAIN, CX_LOG_LEVEL_ERROR, \
134 "file %s: line %d (%s): assertion failed: (%s)", \
135 __FILE__, __LINE__, __PRETTY_FUNCTION__, #expr); \
139 # define cx_assert(expr) \
145 cx_log(CX_LOG_DOMAIN,CX_LOG_LEVEL_ERROR, \
146 "file %s: line %d: assertion failed: (%s)", \
147 __FILE__, __LINE__, #expr); \
cx_log_level_flags cx_log_set_fatal_mask(const cxchar *, cx_log_level_flags)
Sets the log message level which are fatal for a given domain.
Definition: cxmessages.c:741
void cx_critical(const cxchar *format,...)
Log a "critical" warning.
Definition: cxmessages.c:1459
void cx_log(const cxchar *name, cx_log_level_flags level, const cxchar *format,...)
Log a formatted message.
Definition: cxmessages.c:1121
const cxchar * cx_log_get_domain_name(cxsize)
Get the name of a log domain.
Definition: cxmessages.c:706
cx_log_func cx_log_set_default_handler(cx_log_func)
Set the default log handler.
Definition: cxmessages.c:791
void void cx_print_func cx_print_set_handler(cx_print_func)
Set handler for message output.
Definition: cxmessages.c:1239
void cx_warning(const cxchar *format,...)
Log a warning.
Definition: cxmessages.c:1487
void cx_print(const cxchar *format,...)
Output a formatted message via the print handler.
Definition: cxmessages.c:1281
cxsize cx_log_get_domain_count(void)
Get the number of registered log domains.
Definition: cxmessages.c:670
void cx_error(const cxchar *format,...)
Log an error message.
Definition: cxmessages.c:1426
cx_print_func cx_printerr_set_handler(cx_print_func)
Set handler for error message output.
Definition: cxmessages.c:1330
void cx_logv(const cxchar *name, cx_log_level_flags level, const cxchar *format, va_list args)
Log a formatted message using a variable-length argument.
Definition: cxmessages.c:950
cx_log_level_flags cx_log_set_always_fatal(cx_log_level_flags)
Set log levels to be always fatal.
Definition: cxmessages.c:633
void cx_printerr(const cxchar *format,...)
Output a formatted message via the error message handler.
Definition: cxmessages.c:1372
void cx_log_remove_handler(const cxchar *, cxuint)
Remove a log handler from a domain.
Definition: cxmessages.c:879
cxuint cx_log_set_handler(const cxchar *, cx_log_level_flags, cx_log_func, cxptr)
Set the log handler for a log domain.
Definition: cxmessages.c:826
void cx_log_default_handler(const cxchar *, cx_log_level_flags, const cxchar *, cxptr)
Default log handler.
Definition: cxmessages.c:1157
void cx_message(const cxchar *format,...)
Log a normal message.
Definition: cxmessages.c:1514