diff -r bfa935ab7f85 -r 7fc65395188e docs/src/modules.md --- a/docs/src/modules.md Fri May 11 18:46:31 2018 +0200 +++ b/docs/src/modules.md Fri May 11 19:48:19 2018 +0200 @@ -246,7 +246,29 @@ The logging module comes with some predefined log levels and allows some more customization. You may choose if you want to get timestamps or source file and line number logged automatically when outputting a message. - +The following function call initializes a debug logger with all of the above +information: +```C + log = ucx_logger_new(stdout, UCX_LOGGER_DEBUG, + UCX_LOGGER_LEVEL | UCX_LOGGER_TIMESTAMP | UCX_LOGGER_SOURCE); +``` +Afterwards you can use this logger with the predefined macros +```C + ucx_logger_trace(log, "Verbose output"); + ucx_logger_debug(log, "Debug message"); + ucx_logger_info(log, "Information"); + ucx_logger_warn(log, "Warning"); + ucx_logger_error(log, "Error message"); +``` +or you use +```C + ucx_logger_log(log, CUSTOM_LEVEL, "Some message") +``` +When you use your custom log level, don't forget to register it with +```C + ucx_logger_register_level(log, CUSTOM_LEVEL, "CUSTOM") +``` +where the last argument must be a string literal. ## Map @@ -308,6 +330,7 @@ ucx_map_free(myprops); fclose(file); ``` + ## Stack *Header file:* [stack.h](api/stack_8h.html)