Loading...
Searching...
No Matches
Logger
Collaboration diagram for Logger:

## Topics

| Debug messages groups
| Logging options

## Typedefs

typedef void(* | ly_log_clb) (LY_LOG_LEVEL level, const char *msg, const char *data_path, const char *schema_path, uint64_t line)
| Logger callback.

## Enumerations

enum | LY_LOG_LEVEL { LY_LLERR = 0 , LY_LLWRN = 1 , LY_LLVRB = 2 , LY_LLDBG = 3 }
| Verbosity levels of the libyang logger. More...
enum | LY_VECODE { LYVE_SUCCESS = 0 , LYVE_SYNTAX , LYVE_SYNTAX_YANG , LYVE_SYNTAX_YIN , LYVE_REFERENCE , LYVE_XPATH , LYVE_SEMANTICS , LYVE_SYNTAX_XML , LYVE_SYNTAX_JSON , LYVE_DATA , LYVE_OTHER }
| libyang's codes of validation error. Whenever ly_errno is set to LY_EVALID, the ly_vecode is also set to the appropriate LY_VECODE value. More...

## Functions

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

## Detailed Description

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

## Typedef Documentation

## ly_log_clb

typedef void(* ly_log_clb) (LY_LOG_LEVEL level, const char *msg, const char *data_path, const char *schema_path, uint64_t line)

Logger callback.

Parameters

  [in] | level | Log level of the message.
  [in] | msg | Message.
  [in] | data_path | Optional data path of the related node.
  [in] | schema_path | Optional schema path of the related node.
  [in] | line | Optional related input line.

Definition at line 184 of file log.h.

## Enumeration Type Documentation

## LY_LOG_LEVEL

enum LY_LOG_LEVEL

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.

## LY_VECODE

enum LY_VECODE

libyang's codes of validation error. Whenever ly_errno is set to LY_EVALID, the ly_vecode is also set to the appropriate LY_VECODE value.

Enumerator
LYVE_SUCCESS | no error
LYVE_SYNTAX | generic syntax error
LYVE_SYNTAX_YANG | YANG-related syntax error
LYVE_SYNTAX_YIN | YIN-related syntax error
LYVE_REFERENCE | invalid referencing or using an item
LYVE_XPATH | invalid XPath expression
LYVE_SEMANTICS | generic semantic error
LYVE_SYNTAX_XML | XML-related syntax error
LYVE_SYNTAX_JSON | JSON-related syntax error
LYVE_DATA | YANG data does not reflect some of the module restrictions
LYVE_OTHER | Unknown error

Definition at line 264 of file log.h.

## Function Documentation

## ly_get_log_clb()

LIBYANG_API_DECL ly_log_clb ly_get_log_clb | ( | void |  | ) |

Get logger callback.

Returns
  Logger callback (can be NULL).

## ly_log_dbg_groups()

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. Note: does not have any effect on non-debug (Release) builds

Parameters

  [in] | dbg_groups | Bitfield of enabled debug message groups (see Debug messages groups).

Returns
  Previous options bitfield.

## ly_log_level()

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] | level | Verbosity level.

Returns
  Previous verbosity level.

## ly_log_options()

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] | opts | Bitfield of Logging options.

Returns
  Previous logger options.

## ly_set_log_clb()

LIBYANG_API_DECL void ly_set_log_clb | ( | ly_log_clb | clb | ) |

Set logger callback.

Parameters

  [in] | clb | Logging callback.

## ly_temp_log_options()

LIBYANG_API_DECL uint32_t * ly_temp_log_options | ( | uint32_t * | opts | ) |

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

Parameters

  [in] | opts | Pointer to the temporary Logging options. If NULL, restores the effect of global logger options.

Returns
  Previous temporary options.