libkeymap  2.0.1
Library to manage the Linux keymaps
logging.h
Go to the documentation of this file.
1 #ifndef LK_LOGGING_H
2 #define LK_LOGGING_H
3 
4 #include <syslog.h>
5 #include <keymap/context.h>
6 
13 void lk_log(struct lk_ctx *ctx, int priority,
14  const char *file, int line, const char *fn,
15  const char *fmt, ...);
16 
17 #define lk_log_cond(ctx, level, arg...) \
18  do { \
19  if (ctx->log_priority >= level) \
20  lk_log(ctx, level, __FILE__, __LINE__, __func__, ## arg);\
21  } while (0)
22 
28 #define DBG(ctx, arg...) lk_log_cond(ctx, LOG_DEBUG, ## arg)
29 
35 #define INFO(ctx, arg...) lk_log_cond(ctx, LOG_INFO, ## arg)
36 
42 #define WARN(ctx, arg...) lk_log_cond(ctx, LOG_WARNING, ## arg)
43 
49 #define ERR(ctx, arg...) lk_log_cond(ctx, LOG_ERR, ## arg)
50 
51 #endif /* LK_LOGGING_H */
void lk_log(struct lk_ctx *ctx, int priority, const char *file, int line, const char *fn, const char *fmt,...)