A logger written in c.
To construct a new logger object, use the logger_new
function. This function will return a heap allocated logger object. The parametres of the function is the name and default logging level enum value. Just as in my wrapper around the python logging package, the level parametre passed to this function sets the minimum level that the logger will output.
To setup the logger correctly, you will need to either add stdout
or a file. To do so, you will either need to call the logger_add_console
function or logger_add_file
function respectively. To use both stdout
and a file, you need to call the logger_full_setup
function.
To log a message, you need to call the logger_log
function. This function takes a view into the logger object, a null-terminated log message without a newline, and a level with which the message will be logged. If you want to change the default logging level, call the logger_set_level
function.
To deallocate the logger object, call the close_logger
function.