summaryrefslogtreecommitdiff
path: root/src/shared/log.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared/log.h')
-rw-r--r--src/shared/log.h21
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); \
+ })