1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
|
Logging
=======
Functions for logging and getting log data.
.. code:: cpp
#include <util/base.h>
Logging Levels
--------------
**LOG_ERROR** = 100
Use if there's a problem that can potentially affect the program,
but isn't enough to require termination of the program.
Use in creation functions and core subsystem functions. Places that
should definitely not fail.
**LOG_WARNING** = 200
Use if a problem occurs that doesn't affect the program and is
recoverable.
Use in places where failure isn't entirely unexpected, and can
be handled safely.
**LOG_INFO** = 300
Informative message to be displayed in the log.
**LOG_DEBUG** = 400
Debug message to be used mostly by and for developers.
Logging Functions
-----------------
.. type:: void (*log_handler_t)(int lvl, const char *msg, va_list args, void *p)
Logging callback.
---------------------
.. function:: void base_set_log_handler(log_handler_t handler, void *param)
void base_get_log_handler(log_handler_t *handler, void **param)
Sets/gets the current log handler.
---------------------
.. function:: void base_set_crash_handler(void (*handler)(const char *, va_list, void *), void *param)
Sets the current crash handler.
---------------------
.. function:: void blogva(int log_level, const char *format, va_list args)
Logging function (using a va_list).
---------------------
.. function:: void blog(int log_level, const char *format, ...)
Logging function.
---------------------
.. function:: void bcrash(const char *format, ...)
Crash function.
|