libkeymap  2.0.4
Library to manage the Linux keymaps
src/libkeymap/keymap/logging.h
Go to the documentation of this file.
00001 
00005 #ifndef LK_LOGGING_H
00006 #define LK_LOGGING_H
00007 
00008 #include <syslog.h>
00009 #include <keymap/context.h>
00010 
00017 void lk_log(struct lk_ctx *ctx, int priority,
00018             const char *file, int line, const char *fn,
00019             const char *fmt, ...);
00020 
00021 #define lk_log_cond(ctx, level, arg...)                                          \
00022         do {                                                                     \
00023                 if (ctx->log_priority >= level)                                  \
00024                         lk_log(ctx, level, __FILE__, __LINE__, __func__, ##arg); \
00025         } while (0)
00026 
00032 #define DBG(ctx, arg...) lk_log_cond(ctx, LOG_DEBUG, ##arg)
00033 
00039 #define INFO(ctx, arg...) lk_log_cond(ctx, LOG_INFO, ##arg)
00040 
00046 #define WARN(ctx, arg...) lk_log_cond(ctx, LOG_WARNING, ##arg)
00047 
00053 #define ERR(ctx, arg...) lk_log_cond(ctx, LOG_ERR, ##arg)
00054 
00055 #endif /* LK_LOGGING_H */