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)
156 BDI_DECLSPEC_bdiutil
int bdi_log_file_enable(
int notify_level,
const char* filename,
int clear_file );
215 BDI_DECLSPEC_bdiutil
int bdi_log_print(
int notify_level,
const char*
string );
227 #ifdef CPLUSPLUS_ONLY
295 #ifdef CPLUSPLUS_ONLY
312 #ifdef CPLUSPLUS_ONLY
327 #ifdef CPLUSPLUS_ONLY
371 char* result,
int result_buf_size );
383 #ifdef CPLUSPLUS_ONLY
423 #ifdef CPLUSPLUS_ONLY
426 #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__);}
427 #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);}
428 #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__);}
429 #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__);}
430 #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__);}
432 #define bdi_log_debug(string) bdi_log_print(BDI_LOG_DEBUG, string)
433 #define bdi_log_debug_arg0(string) bdi_log_print(BDI_LOG_DEBUG, string)
434 #define bdi_log_debug_arg1(string, arg1) bdi_log_printf(BDI_LOG_DEBUG, string, arg1)
435 #define bdi_log_debug_arg2(string, arg1, arg2) bdi_log_printf(BDI_LOG_DEBUG, string, arg1, arg2)
436 #define bdi_log_debug_arg3(string, arg1, arg2, arg3) bdi_log_printf(BDI_LOG_DEBUG, string, arg1, arg2, arg3)
437 #define bdi_log_debug_arg4(string, arg1, arg2, arg3, arg4) bdi_log_printf(BDI_LOG_DEBUG, string, arg1, arg2, arg3, arg4)
438 #define bdi_log_debug_arg5(string, arg1, arg2, arg3, arg4, arg5) bdi_log_printf(BDI_LOG_DEBUG, string, arg1, arg2, arg3, arg4, arg5)
439 #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)
441 #define bdi_log_debug_lvn(level, string) bdi_log_print(BDI_LOG_DEBUG_LV##level, string)
442 #define bdi_log_debug_lvn_arg0(level, string) bdi_log_print(BDI_LOG_DEBUG_LV##level, string)
443 #define bdi_log_debug_lvn_arg1(level, string, arg1) bdi_log_printf(BDI_LOG_DEBUG_LV##level, string, arg1)
444 #define bdi_log_debug_lvn_arg2(level, string, arg1, arg2) bdi_log_printf(BDI_LOG_DEBUG_LV##level, string, arg1, arg2)
445 #define bdi_log_debug_lvn_arg3(level, string, arg1, arg2, arg3) bdi_log_printf(BDI_LOG_DEBUG_LV##level, string, arg1, arg2, arg3)
446 #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)
447 #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)
448 #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)
452 #define bdi_log_assert(assertion)
453 #define bdi_log_assert_fatal(assertion)
454 #define bdi_log_assert_warn(assertion)
455 #define bdi_log_assert_info(assertion)
456 #define bdi_log_assert_debug(assertion)
458 #define bdi_log_debug(string)
459 #define bdi_log_debug_arg0(string)
460 #define bdi_log_debug_arg1(string, arg1)
461 #define bdi_log_debug_arg2(string, arg1, arg2)
462 #define bdi_log_debug_arg3(string, arg1, arg2, arg3)
463 #define bdi_log_debug_arg4(string, arg1, arg2, arg3, arg4)
464 #define bdi_log_debug_arg5(string, arg1, arg2, arg3, arg4, arg5)
465 #define bdi_log_debug_arg6(string, arg1, arg2, arg3, arg4, arg5, arg6)
467 #define bdi_log_debug_lvn(level, string)
468 #define bdi_log_debug_lvn_arg0(level, string)
469 #define bdi_log_debug_lvn_arg1(level, string, arg1)
470 #define bdi_log_debug_lvn_arg2(level, string, arg1, arg2)
471 #define bdi_log_debug_lvn_arg3(level, string, arg1, arg2, arg3)
472 #define bdi_log_debug_lvn_arg4(level, string, arg1, arg2, arg3, arg4)
473 #define bdi_log_debug_lvn_arg5(level, string, arg1, arg2, arg3, arg4, arg5)
474 #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:76
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...
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:78
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 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:77
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.
void bdi_log_get_string_from_notify_level(int notify_level, char *result, int result_buf_size)
Derives a string from the notify level and returns it in the passed result buffer.
#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.