28#ifndef CORE_GP_DEBUG_H
29#define CORE_GP_DEBUG_H
80#define GP_DEFAULT_DEBUG_LEVEL 0
88#define GP_DEBUG(level, ...) \
89 gp_debug_print(level, __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__)
97 gp_debug_print(GP_DEBUG_TODO, __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__)
104#define GP_WARN(...) \
105 gp_debug_print(GP_DEBUG_WARN, __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__)
113 gp_debug_print(GP_DEBUG_BUG, __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__)
120#define GP_FATAL(...) \
121 gp_debug_print(GP_DEBUG_FATAL, __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__)
A compiler dependent macros.
#define GP_FMT_PRINTF(fmt, list)
Expands to format printf attribute when supported by the compiler.
gp_debug_type
A debug level constants.
@ GP_DEBUG_FATAL
A fatal condition.
@ GP_DEBUG_BUG
A library bug.
@ GP_DEBUG_WARN
A warning.
@ GP_DEBUG_TODO
Not implemented yet.
void gp_set_debug_level(unsigned int level)
Sets current debug level.
void gp_set_debug_handler(void(*handler)(const struct gp_debug_msg *msg))
Redirects debug message into a custom handler.
unsigned int gp_get_debug_level(void)
Returns current debug level.
void gp_debug_print(int level, const char *file, const char *function, int line, const char *fmt,...)
A debug printf handler.
Custom debug message handler structure.
const char * file
A source file the message came from.
const char * msg
The debug message.
const char * fn
A function the message came from.
int level
Message debug level, see gp_debug_type.
unsigned int line
A line the source file the message came from.