libyang  2.2.8
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
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 "ly_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
94 } LY_LOG_LEVEL;
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 
143 LIBYANG_API_DECL uint32_t *ly_temp_log_options(uint32_t *opts);
144 
156 #define LY_LDGDICT 0x01
157 #define LY_LDGXPATH 0x02
158 #define LY_LDGDEPSETS 0x04
173 LIBYANG_API_DECL uint32_t ly_log_dbg_groups(uint32_t dbg_groups);
174 
184 typedef void (*ly_log_clb)(LY_LOG_LEVEL level, const char *msg, const char *data_path, const char *schema_path,
185  uint64_t line);
186 
192 LIBYANG_API_DECL void ly_set_log_clb(ly_log_clb clb);
193 
199 LIBYANG_API_DECL ly_log_clb ly_get_log_clb(void);
200 
237 typedef enum {
238  LY_SUCCESS = 0,
239  LY_EMEM,
251  LY_ENOT,
256 } LY_ERR;
264 typedef enum {
265  LYVE_SUCCESS = 0,
266  LYVE_SYNTAX,
278 
282 struct ly_err_item {
284  LY_ERR err;
286  char *msg;
287  char *data_path;
288  char *schema_path;
289  uint64_t line;
290  char *apptag;
291  struct ly_err_item *next;
292  struct ly_err_item *prev;
293 };
301 LIBYANG_API_DECL const char *ly_strerr(LY_ERR err);
302 
309 LIBYANG_API_DECL const char *ly_strvecode(LY_VECODE vecode);
310 
319 LIBYANG_API_DECL const char *ly_last_logmsg(void);
320 
327 LIBYANG_API_DECL const struct ly_err_item *ly_err_first(const struct ly_ctx *ctx);
328 
335 LIBYANG_API_DECL const struct ly_err_item *ly_err_last(const struct ly_ctx *ctx);
336 
343 LIBYANG_API_DECL void ly_err_print(const struct ly_ctx *ctx, const struct ly_err_item *eitem);
344 
353 LIBYANG_API_DECL void ly_err_clean(struct ly_ctx *ctx, struct ly_err_item *eitem);
354 
357 #ifdef __cplusplus
358 }
359 #endif
360 
361 #endif /* LY_LOG_H_ */
LY_LOG_LEVEL level
Definition: log.h:286
Definition: log.h:255
char * schema_path
Definition: log.h:291
Definition: log.h:244
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().
Definition: log.h:247
uint8_t ly_bool
Type to indicate boolean value.
Definition: log.h:28
Definition: log.h:242
LY_ERR err
Definition: log.h:287
LY_VECODE
libyang&#39;s codes of validation error. Whenever ly_errno is set to LY_EVALID, the ly_vecode is also set...
Definition: log.h:267
char * apptag
Definition: log.h:293
char * msg
Definition: log.h:289
LIBYANG_API_DECL const char * ly_strvecode(LY_VECODE vecode)
Get human-readable error message for a validation error code.
LIBYANG_API_DECL void ly_set_log_clb(ly_log_clb clb)
Set logger callback.
Definition: log.h:90
Libyang full error structure.
Definition: log.h:285
Definition: log.h:277
LY_LOG_LEVEL
Verbosity levels of the libyang logger.
Definition: log.h:88
Definition: log.h:243
LIBYANG_API_DECL ly_log_clb ly_get_log_clb(void)
Get logger callback.
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.
LIBYANG_API_DECL const char * ly_strerr(LY_ERR err)
Get human-readable error message for an error code.
Definition: log.h:91
struct ly_err_item * prev
Definition: log.h:295
Definition: log.h:245
Definition: log.h:92
Definition: log.h:89
LIBYANG_API_DECL LY_LOG_LEVEL ly_log_level(LY_LOG_LEVEL level)
Set logger verbosity level.
LIBYANG_API_DECL void ly_err_clean(struct ly_ctx *ctx, struct ly_err_item *eitem)
Free error structures from a context.
LY_VECODE vecode
Definition: log.h:288
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_last_logmsg(void)
Get the last (thread-specific) full logged error message.
Definition: log.h:248
struct ly_err_item * next
Definition: log.h:294
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:187
uint64_t line
Definition: log.h:292
LIBYANG_API_DECL struct ly_err_item * ly_err_first(const struct ly_ctx *ctx)
Get the first (thread, context-specific) generated error structure.
LY_ERR
libyang&#39;s error codes returned by the libyang functions.
Definition: log.h:240
libyang context handler.
char * data_path
Definition: log.h:290
Definition: log.h:254