summaryrefslogtreecommitdiff
path: root/src/shared/log.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-11-28 02:05:14 +0100
committerLennart Poettering <lennart@poettering.net>2014-11-28 02:18:46 +0100
commite2cc6eca73cd1df8be552d7c23f9ff3d69c06f1e (patch)
tree874e0dac2d1426e44c3e748734cbb297f3feefa8 /src/shared/log.h
parent6c861f0aeff9449ee1201bb56f89861921e41c45 (diff)
log: fix order of log_unit_struct() to match other logging calls
Also, while we are at it, introduce some syntactic sugar for creating ERRNO= and MESSAGE= structured logging fields.
Diffstat (limited to 'src/shared/log.h')
-rw-r--r--src/shared/log.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/shared/log.h b/src/shared/log.h
index 278010432d..3a4d1134a1 100644
--- a/src/shared/log.h
+++ b/src/shared/log.h
@@ -199,7 +199,10 @@ bool log_on_console(void) _pure_;
const char *log_target_to_string(LogTarget target) _const_;
LogTarget log_target_from_string(const char *s) _pure_;
-#define MESSAGE_ID(x) "MESSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(x)
+/* Helpers to prepare various fields for structured logging */
+#define LOG_MESSAGE(fmt, ...) "MESSAGE=" fmt, ##__VA_ARGS__
+#define LOG_MESSAGE_ID(x) "MESSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(x)
+#define LOG_ERRNO(error) "ERRNO=%i", error
void log_received_signal(int level, const struct signalfd_siginfo *si);