libyang  2.0.112
libyang is YANG data modelling language parser and toolkit written (and providing API) in C.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Information Logging

The libyang logger is supposed to process all the messages (and some other accompanied information) generated by the performed functions. According to the logger settings, the information can be printed, stored or further processed by a callback functions.

The logger is tightly connected with errors handling, because when an error appears, the logger (according to logger options) generates error records available via libyang context.

There are 4 verbosity levels defined as LY_LOG_LEVEL. The level can be changed by the ly_log_level() function. By default, the verbosity level is set to LY_LLERR value, so only the errors are processed.

By default, all libyang messages are printed to stderr. However, the callers are able to set their own logging callback function (ly_log_clb). In that case, instead of printing messages, libyang passes error level, message and path (if any) to the caller's callback function set via ly_set_log_clb(). In case of error level, the error information is still automatically stored and available via the error handling functions.

With logging options set via ly_log_options(), the caller can modify what is done with all the messages. Default flags are LY_LOLOG and LY_LOSTORE_LAST so that messages are logged and the last one is stored. If you set the flag LY_LOSTORE, all the messages will be stored. Be careful because unless you regularly clean them, the error list in context will grow indefinitely.

As a separate group, there are Debug messages groups to select group of debugging messages to print. The options can be set via ly_log_dbg_groups() function, but note that the options take effect only in case the libyang is compiled in Debug build mode.

Note
API for this group of functions is described in the logger module.

Functions List