docs/src/modules.md

changeset 295
7fc65395188e
parent 294
bfa935ab7f85
child 297
ba760f2195c3
     1.1 --- a/docs/src/modules.md	Fri May 11 18:46:31 2018 +0200
     1.2 +++ b/docs/src/modules.md	Fri May 11 19:48:19 2018 +0200
     1.3 @@ -246,7 +246,29 @@
     1.4  The logging module comes with some predefined log levels and allows some more
     1.5  customization. You may choose if you want to get timestamps or source file and
     1.6  line number logged automatically when outputting a message.
     1.7 -
     1.8 +The following function call initializes a debug logger with all of the above
     1.9 +information:
    1.10 +```C
    1.11 +    log = ucx_logger_new(stdout, UCX_LOGGER_DEBUG,
    1.12 +            UCX_LOGGER_LEVEL | UCX_LOGGER_TIMESTAMP | UCX_LOGGER_SOURCE);
    1.13 +```
    1.14 +Afterwards you can use this logger with the predefined macros
    1.15 +```C
    1.16 +    ucx_logger_trace(log, "Verbose output");
    1.17 +    ucx_logger_debug(log, "Debug message");
    1.18 +    ucx_logger_info(log, "Information");
    1.19 +    ucx_logger_warn(log, "Warning");
    1.20 +    ucx_logger_error(log, "Error message");
    1.21 +```
    1.22 +or you use
    1.23 +```C
    1.24 +    ucx_logger_log(log, CUSTOM_LEVEL, "Some message")
    1.25 +```
    1.26 +When you use your custom log level, don't forget to register it with
    1.27 +```C
    1.28 +    ucx_logger_register_level(log, CUSTOM_LEVEL, "CUSTOM")
    1.29 +```
    1.30 +where the last argument must be a string literal.
    1.31  
    1.32  ## Map
    1.33  
    1.34 @@ -308,6 +330,7 @@
    1.35  ucx_map_free(myprops);
    1.36  fclose(file);
    1.37  ```
    1.38 +
    1.39  ## Stack
    1.40  
    1.41  *Header file:* [stack.h](api/stack_8h.html)  

mercurial