libyang  2.1.148
libyang is YANG data modelling language parser and toolkit written (and providing API) in C.
log.h
Go to the documentation of this file.
1 
16 #ifndef LY_LOG_H_
17 #define LY_LOG_H_
18 
19 #include <stdint.h>
20 
21 #include "config.h"
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 /* dummy context structure */
28 struct ly_ctx;
29 
35 typedef uint8_t ly_bool;
36 
88 typedef enum {
89  LY_LLERR = 0,
90  LY_LLWRN = 1,
91  LY_LLVRB = 2,
92  LY_LLDBG = 3
95 
104 LIBYANG_API_DECL LY_LOG_LEVEL ly_log_level(LY_LOG_LEVEL level);
105 
116 #define LY_LOLOG 0x01
118 #define LY_LOSTORE 0x02
120 #define LY_LOSTORE_LAST 0x06
135 LIBYANG_API_DECL uint32_t ly_log_options(uint32_t opts);
136 
142 LIBYANG_API_DECL void ly_temp_log_options(uint32_t *opts);
143 
155 #define LY_LDGDICT 0x01
156 #define LY_LDGXPATH 0x02
157 #define LY_LDGDEPSETS 0x04
172 LIBYANG_API_DECL uint32_t ly_log_dbg_groups(uint32_t dbg_groups);
173 
185 typedef void (*ly_log_clb)(LY_LOG_LEVEL level, const char *msg, const char *path);
186 
197 LIBYANG_API_DECL void ly_set_log_clb(ly_log_clb clb, ly_bool path);
198 
203 LIBYANG_API_DECL ly_log_clb ly_get_log_clb(void);
204 
248 typedef enum {
260  LY_ERECOMPILE,
265  LY_EPLUGIN = 128
268 
275 typedef enum {
287  LYVE_OTHER
289 
293 struct ly_err_item {
297  char *msg;
298  char *path;
299  char *apptag;
300  struct ly_err_item *next;
301  struct ly_err_item *prev;
302 };
303 
310 LIBYANG_API_DECL LY_ERR ly_errcode(const struct ly_ctx *ctx);
311 
318 LIBYANG_API_DECL const char *ly_strerrcode(LY_ERR err);
319 
328 LIBYANG_API_DECL LY_VECODE ly_vecode(const struct ly_ctx *ctx);
329 
336 LIBYANG_API_DECL const char *ly_strvecode(LY_VECODE vecode);
337 
348 LIBYANG_API_DECL const char *ly_errmsg(const struct ly_ctx *ctx);
349 
358 LIBYANG_API_DECL const char *ly_last_errmsg(void);
359 
373 LIBYANG_API_DECL const char *ly_errpath(const struct ly_ctx *ctx);
374 
385 LIBYANG_API_DECL const char *ly_errapptag(const struct ly_ctx *ctx);
386 
393 LIBYANG_API_DECL struct ly_err_item *ly_err_first(const struct ly_ctx *ctx);
394 
401 LIBYANG_API_DECL struct ly_err_item *ly_err_last(const struct ly_ctx *ctx);
402 
409 LIBYANG_API_DECL void ly_err_print(const struct ly_ctx *ctx, struct ly_err_item *eitem);
410 
419 LIBYANG_API_DECL void ly_err_clean(struct ly_ctx *ctx, struct ly_err_item *eitem);
420 
423 #ifdef __cplusplus
424 }
425 #endif
426 
427 #endif /* LY_LOG_H_ */
libyang context handler.
struct ly_err_item * prev
Definition: log.h:301
LY_VECODE vecode
Definition: log.h:296
char * apptag
Definition: log.h:299
char * msg
Definition: log.h:297
struct ly_err_item * next
Definition: log.h:300
LY_ERR no
Definition: log.h:295
LY_LOG_LEVEL level
Definition: log.h:294
char * path
Definition: log.h:298
LIBYANG_API_DECL const char * ly_strerrcode(LY_ERR err)
Get human-readable error message for an error code.
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 modu...
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:275
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.
LIBYANG_API_DECL struct ly_err_item * ly_err_last(const struct ly_ctx *ctx)
Get the latest (thread, context-specific) generated error structure.
LIBYANG_API_DECL const char * ly_strvecode(LY_VECODE vecode)
Get human-readable error message for a validation error code.
LIBYANG_API_DECL LY_ERR ly_errcode(const struct ly_ctx *ctx)
Get the last (thread, context-specific) error code.
LIBYANG_API_DECL const char * ly_last_errmsg(void)
Get the last (thread-specific) error message.
LIBYANG_API_DECL LY_VECODE ly_vecode(const struct ly_ctx *ctx)
Get the last (thread, context-specific) validation error code.
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 ...
LY_ERR
libyang's error codes returned by the libyang functions.
Definition: log.h:248
LIBYANG_API_DECL void ly_err_clean(struct ly_ctx *ctx, struct ly_err_item *eitem)
Free error structures from a context.
LIBYANG_API_DECL struct ly_err_item * ly_err_first(const struct ly_ctx *ctx)
Get the first (thread, context-specific) generated error structure.
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.
@ LYVE_OTHER
Definition: log.h:287
@ LYVE_SYNTAX_JSON
Definition: log.h:284
@ LYVE_SYNTAX
Definition: log.h:277
@ LYVE_SYNTAX_XML
Definition: log.h:283
@ LYVE_DATA
Definition: log.h:285
@ LYVE_XPATH
Definition: log.h:281
@ LYVE_SEMANTICS
Definition: log.h:282
@ LYVE_SYNTAX_YANG
Definition: log.h:278
@ LYVE_SUCCESS
Definition: log.h:276
@ LYVE_REFERENCE
Definition: log.h:280
@ LYVE_SYNTAX_YIN
Definition: log.h:279
@ LY_EOTHER
Definition: log.h:263
@ LY_EDENIED
Definition: log.h:257
@ LY_EINVAL
Definition: log.h:252
@ LY_ESYS
Definition: log.h:251
@ LY_EMEM
Definition: log.h:250
@ LY_EEXIST
Definition: log.h:253
@ LY_ENOT
Definition: log.h:262
@ LY_EVALID
Definition: log.h:256
@ LY_EINT
Definition: log.h:255
@ LY_ENOTFOUND
Definition: log.h:254
@ LY_SUCCESS
Definition: log.h:249
@ LY_EPLUGIN
Definition: log.h:265
@ LY_ERECOMPILE
Definition: log.h:260
@ LY_EINCOMPLETE
Definition: log.h:258
Libyang full error structure.
Definition: log.h:293
LIBYANG_API_DECL uint32_t ly_log_dbg_groups(uint32_t dbg_groups)
Enable specific debugging messages (independent of log level).
LIBYANG_API_DECL void ly_temp_log_options(uint32_t *opts)
Set temporary thread-safe logger options overwriting those set by ly_log_options().
LIBYANG_API_DECL ly_log_clb ly_get_log_clb(void)
Get logger callback.
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, ly_bool path)
Set logger callback.
LY_LOG_LEVEL
Verbosity levels of the libyang logger.
Definition: log.h:88
void(* ly_log_clb)(LY_LOG_LEVEL level, const char *msg, const char *path)
Logger callback.
Definition: log.h:185
@ LY_LLERR
Definition: log.h:89
@ LY_LLVRB
Definition: log.h:91
@ LY_LLWRN
Definition: log.h:90
@ LY_LLDBG
Definition: log.h:92
uint8_t ly_bool
Type to indicate boolean value.
Definition: log.h:28