libyang  2.1.148
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
log.h File Reference

Logger manipulation routines and error definitions. More...

#include <stdint.h>
#include "config.h"
Include dependency graph for log.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ly_err_item
 Libyang full error structure. More...
 

Macros

#define LY_LDGDEPSETS   0x04
 
#define LY_LDGDICT   0x01
 
#define LY_LDGXPATH   0x02
 
#define LY_LOLOG   0x01
 
#define LY_LOSTORE   0x02
 
#define LY_LOSTORE_LAST   0x06
 

Typedefs

typedef uint8_t ly_bool
 Type to indicate boolean value. More...
 
typedef void(* ly_log_clb )(LY_LOG_LEVEL level, const char *msg, const char *path)
 Logger callback. More...
 

Enumerations

enum  LY_ERR {
  LY_SUCCESS = 0, LY_EMEM, LY_ESYS, LY_EINVAL,
  LY_EEXIST, LY_ENOTFOUND, LY_EINT, LY_EVALID,
  LY_EDENIED, LY_EINCOMPLETE, LY_ERECOMPILE, LY_ENOT,
  LY_EOTHER, LY_EPLUGIN = 128
}
 libyang's error codes returned by the libyang functions. More...
 
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 void ly_err_clean (struct ly_ctx *ctx, struct ly_err_item *eitem)
 Free error structures from a context. More...
 
LIBYANG_API_DECL struct
ly_err_item
ly_err_first (const struct ly_ctx *ctx)
 Get the first (thread, context-specific) generated error structure. More...
 
LIBYANG_API_DECL struct
ly_err_item
ly_err_last (const struct ly_ctx *ctx)
 Get the latest (thread, context-specific) generated error structure. More...
 
LIBYANG_API_DECL void ly_err_print (const struct ly_ctx *ctx, struct ly_err_item *eitem)
 Print the error structure as if just generated. More...
 
LIBYANG_API_DECL const char * ly_errapptag (const struct ly_ctx *ctx)
 Get the last (thread, context-specific) error-app-tag if there was a specific one defined in the module for the last error. More...
 
LIBYANG_API_DECL LY_ERR ly_errcode (const struct ly_ctx *ctx)
 Get the last (thread, context-specific) error code. More...
 
LIBYANG_API_DECL const char * ly_errmsg (const struct ly_ctx *ctx)
 Get the last (thread, context-specific) error message. If the coresponding module defined a specific error message, it will be used instead the default one. More...
 
LIBYANG_API_DECL const char * ly_errpath (const struct ly_ctx *ctx)
 Get the last (thread, context-specific) path of the element where was an error. More...
 
LIBYANG_API_DECL ly_log_clb ly_get_log_clb (void)
 Get logger callback. More...
 
LIBYANG_API_DECL const char * ly_last_errmsg (void)
 Get the last (thread-specific) error message. 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 const char * ly_strerrcode (LY_ERR err)
 Get human-readable error message for an error code. More...
 
LIBYANG_API_DECL const char * ly_strvecode (LY_VECODE vecode)
 Get human-readable error message for a validation error code. 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...
 
LIBYANG_API_DECL LY_VECODE ly_vecode (const struct ly_ctx *ctx)
 Get the last (thread, context-specific) validation error code. More...
 

Detailed Description

Logger manipulation routines and error definitions.

Author
Radek Krejci rkrej.nosp@m.ci@c.nosp@m.esnet.nosp@m..cz
Michal Vasko mvask.nosp@m.o@ce.nosp@m.snet..nosp@m.cz Copyright (c) 2015 - 2022 CESNET, z.s.p.o.

This source code is licensed under BSD 3-Clause License (the "License"). You may not use this file except in compliance with the License. You may obtain a copy of the License at

https://opensource.org/licenses/BSD-3-Clause

Definition in file log.h.

Typedef Documentation

typedef uint8_t ly_bool

Type to indicate boolean value.

Do not test for actual value. Instead, handle it as true/false value in condition.

Definition at line 28 of file log.h.