diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-04-21 17:26:04 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-04-21 17:43:55 +0200 |
commit | 158350e86923cb1d878d3bf7d928fb1c30a3da76 (patch) | |
tree | 3731231a28497ade4ef8605f893136563bccd3cf /src/shared/log.h | |
parent | 200c7fa6fea5aea301e5b091338c5dc1f88f759c (diff) |
log: move log_syntax() into src/shared/log.c, and make it more similar to the other log functions
Diffstat (limited to 'src/shared/log.h')
-rw-r--r-- | src/shared/log.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/shared/log.h b/src/shared/log.h index d6061c05ea..09d2fc767b 100644 --- a/src/shared/log.h +++ b/src/shared/log.h @@ -28,8 +28,8 @@ #include <sys/signalfd.h> #include <errno.h> -#include "macro.h" #include "sd-id128.h" +#include "macro.h" typedef enum LogTarget{ LOG_TARGET_CONSOLE, @@ -209,3 +209,22 @@ LogTarget log_target_from_string(const char *s) _pure_; void log_received_signal(int level, const struct signalfd_siginfo *si); void log_set_upgrade_syslog_to_journal(bool b); + +int log_syntax_internal( + const char *unit, + int level, + const char *config_file, + unsigned config_line, + int error, + const char *file, + int line, + const char *func, + const char *format, ...) _printf_(9, 10); + +#define log_syntax(unit, level, config_file, config_line, error, ...) \ + ({ \ + int _level = (level), _e = (error); \ + (log_get_max_level() >= LOG_PRI(_level)) \ + ? log_syntax_internal(unit, _level, config_file, config_line, _e, __FILE__, __LINE__, __func__, __VA_ARGS__) \ + : -abs(_e); \ + }) |