libyang  2.1.111
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
Logger

Modules

 Debug messages groups
 
 Logging options
 

Typedefs

typedef void(* ly_log_clb )(LY_LOG_LEVEL level, const char *msg, const char *path)
 Logger callback. More...
 

Enumerations

enum  LY_LOG_LEVEL { LY_LLERR = 0, LY_LLWRN = 1, LY_LLVRB = 2, LY_LLDBG = 3 }
 Verbosity levels of the libyang logger. More...
 

Functions

LIBYANG_API_DECL ly_log_clb ly_get_log_clb (void)
 Get logger callback. More...
 
LIBYANG_API_DECL uint32_t ly_log_dbg_groups (uint32_t dbg_groups)
 Enable specific debugging messages (independent of log level). More...
 
LIBYANG_API_DECL LY_LOG_LEVEL ly_log_level (LY_LOG_LEVEL level)
 Set logger verbosity level. More...
 
LIBYANG_API_DECL uint32_t ly_log_options (uint32_t opts)
 Set logger options. Default is LY_LOLOG | LY_LOSTORE_LAST. More...
 
LIBYANG_API_DECL void ly_set_log_clb (ly_log_clb clb, ly_bool path)
 Set logger callback. More...
 
LIBYANG_API_DECL void ly_temp_log_options (uint32_t *opts)
 Set temporary thread-safe logger options overwriting those set by ly_log_options(). More...
 

Detailed Description

Publicly visible functions and values of the libyang logger. For more information, see Information Logging.

Typedef Documentation

typedef void(* ly_log_clb)(LY_LOG_LEVEL level, const char *msg, const char *path)

Logger callback.

!IMPORTANT! If an error has a specific error-app-tag defined in the model, it will NOT be set at the time of calling this callback. It will be set right after, so to retrieve it it must be checked afterwards with ly_errapptag().

Parameters
[in]levelLog level of the message.
[in]msgMessage.
[in]pathOptional path of the concerned node.

Definition at line 191 of file log.h.

Enumeration Type Documentation

Verbosity levels of the libyang logger.

Enumerator
LY_LLERR 

Print only error messages.

LY_LLWRN 

Print error and warning messages, default value.

LY_LLVRB 

Besides errors and warnings, print some other verbose messages.

LY_LLDBG 

Print all messages including some development debug messages (be careful, without subsequently calling ly_log_dbg_groups() no debug messages will be printed!).

Definition at line 88 of file log.h.

Function Documentation

LIBYANG_API_DECL ly_log_clb ly_get_log_clb ( void  )

Get logger callback.

Returns
Logger callback (can be NULL).
LIBYANG_API_DECL uint32_t ly_log_dbg_groups ( uint32_t  dbg_groups)

Enable specific debugging messages (independent of log level).

To get the current value, the function must be called twice resetting the level by the received value.

Parameters
[in]dbg_groupsBitfield of enabled debug message groups (see Debug messages groups).
Returns
Previous options bitfield.
LIBYANG_API_DECL LY_LOG_LEVEL ly_log_level ( LY_LOG_LEVEL  level)

Set logger verbosity level.

To get the current value, the function must be called twice resetting the level by the received value.

Parameters
[in]levelVerbosity level.
Returns
Previous verbosity level.
LIBYANG_API_DECL uint32_t ly_log_options ( uint32_t  opts)

Set logger options. Default is LY_LOLOG | LY_LOSTORE_LAST.

To get the current value, the function must be called twice resetting the level by the received value.

Parameters
[in]optsBitfield of Logging options.
Returns
Previous logger options.
LIBYANG_API_DECL void ly_set_log_clb ( ly_log_clb  clb,
ly_bool  path 
)

Set logger callback.

Parameters
[in]clbLogging callback.
[in]pathflag to resolve and provide path as the third parameter of the callback function. In case of validation and some other errors, it can be useful to get the path to the problematic element. Note, that according to the tree type and the specific situation, the path can slightly differs (keys presence) or it can be NULL, so consider it as an optional parameter. If the flag is 0, libyang will not bother with resolving the path.
LIBYANG_API_DECL void ly_temp_log_options ( uint32_t *  opts)

Set temporary thread-safe logger options overwriting those set by ly_log_options().

Parameters
[in]optsPointer to the temporary Logging options. If NULL, restores the effect of global logger options.