20 #define CHECK_PRINTF_FORMAT
22 #define CPLUSPLUS_ONLY
23 #if defined(__GNUC__) && (__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ > 4))
24 #define CHECK_PRINTF_FORMAT __attribute__ ((format (printf, 2, 3)))
26 #define CHECK_PRINTF_FORMAT
46 #define BDI_LOG_MAX_CALLBACKS (8)
47 #define BDI_LOG_BAD_CALLBACK_HANDLE (-1)
54 #define BDI_LOG_NOTHING (-1)
55 #define BDI_LOG_ALWAYS (0)
56 #define BDI_LOG_FATAL (1)
57 #define BDI_LOG_ERROR (2)
58 #define BDI_LOG_WARN (3)
59 #define BDI_LOG_INFO (4)
60 #define BDI_LOG_DEBUG (5)
61 #define BDI_LOG_DEBUG_LV1 (6)
62 #define BDI_LOG_DEBUG_LV2 (7)
63 #define BDI_LOG_DEBUG_LV3 (8)
64 #define BDI_LOG_DEBUG_LV4 (9)
65 #define BDI_LOG_DEBUG_LV5 (10)
66 #define BDI_LOG_DEBUG_LV6 (11)
67 #define BDI_LOG_DEBUG_LV7 (12)
68 #define BDI_LOG_DEBUG_LV8 (13)
69 #define BDI_LOG_DEBUG_LV9 (14)
70 #define BDI_LOG_EVERYTHING (15)
71 #define BDI_LOG_LEVEL_COUNT (16)
157 BDI_DECLSPEC_bdiutil
int bdi_log_file_enable(
int notify_level,
const char* filename,
int clear_file );
216 BDI_DECLSPEC_bdiutil
int bdi_log_print(
int notify_level,
const char*
string );
228 #ifdef CPLUSPLUS_ONLY
296 #ifdef CPLUSPLUS_ONLY
313 #ifdef CPLUSPLUS_ONLY
328 #ifdef CPLUSPLUS_ONLY
397 #ifdef CPLUSPLUS_ONLY
437 #ifdef CPLUSPLUS_ONLY
440 #define bdi_log_assert(assertion) if (!(assertion)) {bdi_log_printf(BDI_LOG_ERROR, "ERROR: Assertion '%s' failed in file %s line %d\n", #assertion, __FILE__, __LINE__);}
441 #define bdi_log_assert_fatal(assertion) if (!(assertion)) {bdi_log_printf(BDI_LOG_FATAL, "FATAL: Assertion '%s' failed in file %s line %d\n", #assertion, __FILE__, __LINE__); exit(EXIT_FAILURE);}
442 #define bdi_log_assert_warn(assertion) if (!(assertion)) {bdi_log_printf(BDI_LOG_WARN, "WARNING: Assertion '%s' failed in file %s line %d\n", #assertion, __FILE__, __LINE__);}
443 #define bdi_log_assert_info(assertion) if (!(assertion)) {bdi_log_printf(BDI_LOG_INFO, "INFO: Assertion '%s' failed in file %s line %d\n", #assertion, __FILE__, __LINE__);}
444 #define bdi_log_assert_debug(assertion) if (!(assertion)) {bdi_log_printf(BDI_LOG_DEBUG, "DEBUG: Assertion '%s' failed in file %s line %d\n", #assertion, __FILE__, __LINE__);}
446 #define bdi_log_debug(string) bdi_log_print(BDI_LOG_DEBUG, string)
447 #define bdi_log_debug_arg0(string) bdi_log_print(BDI_LOG_DEBUG, string)
448 #define bdi_log_debug_arg1(string, arg1) bdi_log_printf(BDI_LOG_DEBUG, string, arg1)
449 #define bdi_log_debug_arg2(string, arg1, arg2) bdi_log_printf(BDI_LOG_DEBUG, string, arg1, arg2)
450 #define bdi_log_debug_arg3(string, arg1, arg2, arg3) bdi_log_printf(BDI_LOG_DEBUG, string, arg1, arg2, arg3)
451 #define bdi_log_debug_arg4(string, arg1, arg2, arg3, arg4) bdi_log_printf(BDI_LOG_DEBUG, string, arg1, arg2, arg3, arg4)
452 #define bdi_log_debug_arg5(string, arg1, arg2, arg3, arg4, arg5) bdi_log_printf(BDI_LOG_DEBUG, string, arg1, arg2, arg3, arg4, arg5)
453 #define bdi_log_debug_arg6(string, arg1, arg2, arg3, arg4, arg5, arg6) bdi_log_printf(BDI_LOG_DEBUG, string, arg1, arg2, arg3, arg4, arg5, arg6)
455 #define bdi_log_debug_lvn(level, string) bdi_log_print(BDI_LOG_DEBUG_LV##level, string)
456 #define bdi_log_debug_lvn_arg0(level, string) bdi_log_print(BDI_LOG_DEBUG_LV##level, string)
457 #define bdi_log_debug_lvn_arg1(level, string, arg1) bdi_log_printf(BDI_LOG_DEBUG_LV##level, string, arg1)
458 #define bdi_log_debug_lvn_arg2(level, string, arg1, arg2) bdi_log_printf(BDI_LOG_DEBUG_LV##level, string, arg1, arg2)
459 #define bdi_log_debug_lvn_arg3(level, string, arg1, arg2, arg3) bdi_log_printf(BDI_LOG_DEBUG_LV##level, string, arg1, arg2, arg3)
460 #define bdi_log_debug_lvn_arg4(level, string, arg1, arg2, arg3, arg4) bdi_log_printf(BDI_LOG_DEBUG_LV##level, string, arg1, arg2, arg3, arg4)
461 #define bdi_log_debug_lvn_arg5(level, string, arg1, arg2, arg3, arg4, arg5) bdi_log_printf(BDI_LOG_DEBUG_LV##level, string, arg1, arg2, arg3, arg4, arg5)
462 #define bdi_log_debug_lvn_arg6(level, string, arg1, arg2, arg3, arg4, arg5, arg6) bdi_log_printf(BDI_LOG_DEBUG_LV##level, string, arg1, arg2, arg3, arg4, arg5, arg6)
466 #define bdi_log_assert(assertion)
467 #define bdi_log_assert_fatal(assertion)
468 #define bdi_log_assert_warn(assertion)
469 #define bdi_log_assert_info(assertion)
470 #define bdi_log_assert_debug(assertion)
472 #define bdi_log_debug(string)
473 #define bdi_log_debug_arg0(string)
474 #define bdi_log_debug_arg1(string, arg1)
475 #define bdi_log_debug_arg2(string, arg1, arg2)
476 #define bdi_log_debug_arg3(string, arg1, arg2, arg3)
477 #define bdi_log_debug_arg4(string, arg1, arg2, arg3, arg4)
478 #define bdi_log_debug_arg5(string, arg1, arg2, arg3, arg4, arg5)
479 #define bdi_log_debug_arg6(string, arg1, arg2, arg3, arg4, arg5, arg6)
481 #define bdi_log_debug_lvn(level, string)
482 #define bdi_log_debug_lvn_arg0(level, string)
483 #define bdi_log_debug_lvn_arg1(level, string, arg1)
484 #define bdi_log_debug_lvn_arg2(level, string, arg1, arg2)
485 #define bdi_log_debug_lvn_arg3(level, string, arg1, arg2, arg3)
486 #define bdi_log_debug_lvn_arg4(level, string, arg1, arg2, arg3, arg4)
487 #define bdi_log_debug_lvn_arg5(level, string, arg1, arg2, arg3, arg4, arg5)
488 #define bdi_log_debug_lvn_arg6(level, string, arg1, arg2, arg3, arg4, arg5, arg6)
int bdi_log_print(int notify_level, const char *string)
This function sends the specified string to all open logs.
int bdiLogCallbackFunction(int notify_level, const char *string, void *user_data)
Definition: libbdilog.h:77
void bdi_log_unlock()
This function releases the lock of the logging system.
void bdi_log_register_fatal_exit_function(bdiLogFatalExitFunction *fatal_exit_func)
This function registers a function that will be called if a log message is sent with level BDI_LOG_FA...
const char * diguy_notify_level_to_string(int notify_level)
Converts a notify level integer into a uppercase C-string such as "INFO" or "WARNING".
int bdi_log_print_to_output_window(const char *format,...)
This function prints using OutputDebugString on Windows, which will show up in the Output window in M...
int bdi_log_get_global_notify_level()
Returns the most recent setting of bdi_log_set_global_notify_level().
int bdi_log_set_notify_level(bdiCallbackHandle handle, int notify_level)
This function changes the notify level of a registered callback.
int bdi_log_stderr_enable(int notify_level)
This function will route a copy of appropriate log messages to stdio's stderr.
int bdi_log_stderr_disable()
This function shuts down the log opened by bdi_log_stderr_enable().
int bdi_log_get_file_notify_level()
Returns the most recent setting of bdi_log_set_file_notify_level(int).
int bdi_log_file_disable()
This function shuts down the log opened by bdi_log_file_enable().
bdiCallbackHandle bdi_log_register_callback(int notify_level, bdiLogCallbackFunction *callback, void *user_data)
This function registers a callback for the specified notify_level.
void bdi_log_lock()
This function grabs the lock of the logging system.
int bdi_log_get_num_logs_open()
This function returns the number of logs currently open.
const char * bdiLogPrefixFunction(void *user_data)
Definition: libbdilog.h:79
int bdi_log_file_enable(int notify_level, const char *filename, int clear_file)
This function will route a copy of appropriate log messages to the named file.
int diguy_notify_level_from_string(const char *string)
Converts a notify level string such as "INFO" or "WARNING" back into the corresponding BDI_LOG_* inte...
int bdi_log_stdout_disable()
This function shuts down the log opened by bdi_log_stdout_enable().
int bdiCallbackHandle
Definition: libbdilog.h:43
int bdi_log_set_file_notify_level(int notify_level)
This function sets the log file notify level.
int bdiLogFatalExitFunction(void)
Definition: libbdilog.h:78
int bdi_log_unregister_callback(bdiCallbackHandle handle)
This function unregisters a previously registered callback.
int bdi_log_stdout_enable(int notify_level)
This function will route a copy of appropriate log messages to stdio's stdout.
#define CHECK_PRINTF_FORMAT
Definition: libbdilog.h:25
int bdi_log_printf(int notify_level, const char *format,...) CHECK_PRINTF_FORMAT
printf-like version of bdi_log_print().
int bdi_log_set_global_notify_level(int notify_level)
This function sets the global notify level.
int bdi_log_get_notify_level(bdiCallbackHandle handle)
This function returns the notify level of a registered callback.