Loading...
Searching...
No Matches
log.h
Go to the documentation of this file.
#ifndef LY_LOG_H_
#define LY_LOG_H_
#include <stdint.h>
#include "ly_config.h"
#ifdef __cplusplus
extern "C" {
#endif
/* dummy context structure */
struct ly_ctx;
typedef uint8_t ly_bool;
typedef enum {
LY_LLERR = 0,
LY_LLWRN = 1,
LY_LLVRB = 2,
LY_LLDBG = 3
} LY_LOG_LEVEL;
LIBYANG_API_DECL LY_LOG_LEVEL ly_log_level(LY_LOG_LEVEL level);
#define LY_LOLOG 0x01
#define LY_LOSTORE 0x02
#define LY_LOSTORE_LAST 0x06
LIBYANG_API_DECL uint32_t ly_log_options(uint32_t opts);
LIBYANG_API_DECL uint32_t *ly_temp_log_options(uint32_t *opts);
#define LY_LDGDICT 0x01
#define LY_LDGXPATH 0x02
#define LY_LDGDEPSETS 0x04
LIBYANG_API_DECL uint32_t ly_log_dbg_groups(uint32_t dbg_groups);
typedef void (*ly_log_clb)(LY_LOG_LEVEL level, const char *msg, const char *data_path, const char *schema_path,
uint64_t line);
LIBYANG_API_DECL void ly_set_log_clb(ly_log_clb clb);
LIBYANG_API_DECL ly_log_clb ly_get_log_clb(void);
typedef enum {
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
} LY_ERR;
typedef enum {
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
} LY_VECODE;
struct ly_err_item {
LY_LOG_LEVEL level;
LY_ERR err;
LY_VECODE vecode;
char *msg;
char *data_path;
char *schema_path;
uint64_t line;
char *apptag;
struct ly_err_item *next;
struct ly_err_item *prev;
};
LIBYANG_API_DECL const char *ly_strerr(LY_ERR err);
LIBYANG_API_DECL const char *ly_strvecode(LY_VECODE vecode);
LIBYANG_API_DECL const char *ly_last_logmsg(void);
LIBYANG_API_DECL const struct ly_err_item *ly_err_first(const struct ly_ctx *ctx);
LIBYANG_API_DECL const struct ly_err_item *ly_err_last(const struct ly_ctx *ctx);
LIBYANG_API_DECL void ly_err_print(const struct ly_ctx *ctx, const struct ly_err_item *eitem);
LIBYANG_API_DECL void ly_err_clean(struct ly_ctx *ctx, struct ly_err_item *eitem);
#ifdef __cplusplus
}
#endif
#endif /* LY_LOG_H_ */
ly_ctx
libyang context handler.
ly_err_item::prev
struct ly_err_item * prev
Definition log.h:292
ly_err_item::err
LY_ERR err
Definition log.h:284
ly_err_item::vecode
LY_VECODE vecode
Definition log.h:285
ly_err_item::schema_path
char * schema_path
Definition log.h:288
ly_err_item::line
uint64_t line
Definition log.h:289
ly_err_item::data_path
char * data_path
Definition log.h:287
ly_err_item::apptag
char * apptag
Definition log.h:290
ly_err_item::msg
char * msg
Definition log.h:286
ly_err_item::next
struct ly_err_item * next
Definition log.h:291
ly_err_item::level
LY_LOG_LEVEL level
Definition log.h:283
ly_last_logmsg
LIBYANG_API_DECL const char * ly_last_logmsg(void)
Get the last (thread-specific) full logged error message.
ly_err_last
LIBYANG_API_DECL const struct ly_err_item * ly_err_last(const struct ly_ctx *ctx)
Get the latest (thread, context-specific) generated error structure.
ly_strerr
LIBYANG_API_DECL const char * ly_strerr(LY_ERR err)
Get human-readable error message for an error code.
ly_err_print
LIBYANG_API_DECL void ly_err_print(const struct ly_ctx *ctx, const struct ly_err_item *eitem)
Print the error structure as if just generated.
LY_ERR
LY_ERR
libyang's error codes returned by the libyang functions.
Definition log.h:237
ly_strvecode
LIBYANG_API_DECL const char * ly_strvecode(LY_VECODE vecode)
Get human-readable error message for a validation error code.
ly_err_clean
LIBYANG_API_DECL void ly_err_clean(struct ly_ctx *ctx, struct ly_err_item *eitem)
Free error structures from a context.
ly_err_first
LIBYANG_API_DECL const struct ly_err_item * ly_err_first(const struct ly_ctx *ctx)
Get the first (thread, context-specific) generated error structure.
LYVE_OTHER
@ LYVE_OTHER
Definition log.h:276
LYVE_SYNTAX_JSON
@ LYVE_SYNTAX_JSON
Definition log.h:273
LYVE_SYNTAX
@ LYVE_SYNTAX
Definition log.h:266
LYVE_SYNTAX_XML
@ LYVE_SYNTAX_XML
Definition log.h:272
LYVE_DATA
@ LYVE_DATA
Definition log.h:274
LYVE_XPATH
@ LYVE_XPATH
Definition log.h:270
LYVE_SEMANTICS
@ LYVE_SEMANTICS
Definition log.h:271
LYVE_SYNTAX_YANG
@ LYVE_SYNTAX_YANG
Definition log.h:267
LYVE_SUCCESS
@ LYVE_SUCCESS
Definition log.h:265
LYVE_REFERENCE
@ LYVE_REFERENCE
Definition log.h:269
LYVE_SYNTAX_YIN
@ LYVE_SYNTAX_YIN
Definition log.h:268
LY_EOTHER
@ LY_EOTHER
Definition log.h:252
LY_EDENIED
@ LY_EDENIED
Definition log.h:246
LY_EINVAL
@ LY_EINVAL
Definition log.h:241
LY_ESYS
@ LY_ESYS
Definition log.h:240
LY_EMEM
@ LY_EMEM
Definition log.h:239
LY_EEXIST
@ LY_EEXIST
Definition log.h:242
LY_ENOT
@ LY_ENOT
Definition log.h:251
LY_EVALID
@ LY_EVALID
Definition log.h:245
LY_EINT
@ LY_EINT
Definition log.h:244
LY_ENOTFOUND
@ LY_ENOTFOUND
Definition log.h:243
LY_SUCCESS
@ LY_SUCCESS
Definition log.h:238
LY_EPLUGIN
@ LY_EPLUGIN
Definition log.h:254
LY_ERECOMPILE
@ LY_ERECOMPILE
Definition log.h:249
LY_EINCOMPLETE
@ LY_EINCOMPLETE
Definition log.h:247
ly_err_item
Libyang full error structure.
Definition log.h:282
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).
LY_VECODE
LY_VECODE
libyang's codes of validation error. Whenever ly_errno is set to LY_EVALID, the ly_vecode is also set...
Definition log.h:264
ly_log_clb
void(* ly_log_clb)(LY_LOG_LEVEL level, const char *msg, const char *data_path, const char *schema_path, uint64_t line)
Logger callback.
Definition log.h:184
ly_get_log_clb
LIBYANG_API_DECL ly_log_clb ly_get_log_clb(void)
Get logger callback.
ly_log_level
LIBYANG_API_DECL LY_LOG_LEVEL ly_log_level(LY_LOG_LEVEL level)
Set logger verbosity level.
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().
ly_log_options
LIBYANG_API_DECL uint32_t ly_log_options(uint32_t opts)
Set logger options. Default is LY_LOLOG | LY_LOSTORE_LAST.
LY_LOG_LEVEL
LY_LOG_LEVEL
Verbosity levels of the libyang logger.
Definition log.h:88
ly_set_log_clb
LIBYANG_API_DECL void ly_set_log_clb(ly_log_clb clb)
Set logger callback.
LY_LLERR
@ LY_LLERR
Definition log.h:89
LY_LLVRB
@ LY_LLVRB
Definition log.h:91
LY_LLWRN
@ LY_LLWRN
Definition log.h:90
LY_LLDBG
@ LY_LLDBG
Definition log.h:92
ly_bool
uint8_t ly_bool
Type to indicate boolean value.
Definition log.h:35