libkeymap  2.0.4
Library to manage the Linux keymaps
logging.h
Go to the documentation of this file.
1 
5 #ifndef LK_LOGGING_H
6 #define LK_LOGGING_H
7 
8 #include <syslog.h>
9 #include <keymap/context.h>
10 
17 void lk_log(struct lk_ctx *ctx, int priority,
18  const char *file, int line, const char *fn,
19  const char *fmt, ...);
20 
21 #define lk_log_cond(ctx, level, arg...) \
22  do { \
23  if (ctx->log_priority >= level) \
24  lk_log(ctx, level, __FILE__, __LINE__, __func__, ##arg); \
25  } while (0)
26 
32 #define DBG(ctx, arg...) lk_log_cond(ctx, LOG_DEBUG, ##arg)
33 
39 #define INFO(ctx, arg...) lk_log_cond(ctx, LOG_INFO, ##arg)
40 
46 #define WARN(ctx, arg...) lk_log_cond(ctx, LOG_WARNING, ##arg)
47 
53 #define ERR(ctx, arg...) lk_log_cond(ctx, LOG_ERR, ##arg)
54 
55 #endif /* LK_LOGGING_H */
Header contains flags, keywords and context structure.
void lk_log(struct lk_ctx *ctx, int priority, const char *file, int line, const char *fn, const char *fmt,...)