summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/job.c6
-rw-r--r--src/core/manager.c6
-rw-r--r--src/core/unit.c2
-rw-r--r--src/journal/journald.c2
-rw-r--r--src/login/logind-dbus.c3
-rw-r--r--src/login/logind-seat.c4
-rw-r--r--src/login/logind-session.c4
-rw-r--r--src/sleep/sleep.c8
-rw-r--r--src/systemd/sd-id128.h1
-rw-r--r--src/timedate/timedated.c4
10 files changed, 20 insertions, 20 deletions
diff --git a/src/core/job.c b/src/core/job.c
index 706910b695..cb5674b5a8 100644
--- a/src/core/job.c
+++ b/src/core/job.c
@@ -705,7 +705,7 @@ static void job_log_status_message(Unit *u, JobType t, JobResult result) {
mid = result == JOB_DONE ? SD_MESSAGE_UNIT_STARTED : SD_MESSAGE_UNIT_FAILED;
log_struct(result == JOB_DONE ? LOG_INFO : LOG_ERR,
- "MESSSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(mid),
+ MESSAGE_ID(mid),
"UNIT=%s", u->id,
"RESULT=%s", job_result_to_string(result),
"MESSAGE=%s", buf,
@@ -713,7 +713,7 @@ static void job_log_status_message(Unit *u, JobType t, JobResult result) {
} else if (t == JOB_STOP)
log_struct(result == JOB_DONE ? LOG_INFO : LOG_ERR,
- "MESSSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(SD_MESSAGE_UNIT_STOPPED),
+ MESSAGE_ID(SD_MESSAGE_UNIT_STOPPED),
"UNIT=%s", u->id,
"RESULT=%s", job_result_to_string(result),
"MESSAGE=%s", buf,
@@ -721,7 +721,7 @@ static void job_log_status_message(Unit *u, JobType t, JobResult result) {
else if (t == JOB_RELOAD)
log_struct(result == JOB_DONE ? LOG_INFO : LOG_ERR,
- "MESSSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(SD_MESSAGE_UNIT_RELOADED),
+ MESSAGE_ID(SD_MESSAGE_UNIT_RELOADED),
"UNIT=%s", u->id,
"RESULT=%s", job_result_to_string(result),
"MESSAGE=%s", buf,
diff --git a/src/core/manager.c b/src/core/manager.c
index 6fecbc3f71..b19fc3d508 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -2039,7 +2039,7 @@ void manager_check_finished(Manager *m) {
if (!log_on_console())
log_struct(LOG_INFO,
- "MESSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(SD_MESSAGE_STARTUP_FINISHED),
+ MESSAGE_ID(SD_MESSAGE_STARTUP_FINISHED),
"KERNEL_USEC=%llu", (unsigned long long) kernel_usec,
"INITRD_USEC=%llu", (unsigned long long) initrd_usec,
"USERSPACE_USEC=%llu", (unsigned long long) userspace_usec,
@@ -2055,7 +2055,7 @@ void manager_check_finished(Manager *m) {
if (!log_on_console())
log_struct(LOG_INFO,
- "MESSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(SD_MESSAGE_STARTUP_FINISHED),
+ MESSAGE_ID(SD_MESSAGE_STARTUP_FINISHED),
"KERNEL_USEC=%llu", (unsigned long long) kernel_usec,
"USERSPACE_USEC=%llu", (unsigned long long) userspace_usec,
"MESSAGE=Startup finished in %s (kernel) + %s (userspace) = %s.",
@@ -2070,7 +2070,7 @@ void manager_check_finished(Manager *m) {
if (!log_on_console())
log_struct(LOG_INFO,
- "MESSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(SD_MESSAGE_STARTUP_FINISHED),
+ MESSAGE_ID(SD_MESSAGE_STARTUP_FINISHED),
"USERSPACE_USEC=%llu", (unsigned long long) userspace_usec,
"MESSAGE=Startup finished in %s.",
format_timespan(sum, sizeof(sum), total_usec),
diff --git a/src/core/unit.c b/src/core/unit.c
index ae43545c6f..6396bfc09f 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -1023,7 +1023,7 @@ static void unit_status_log_starting_stopping_reloading(Unit *u, JobType t) {
SD_MESSAGE_UNIT_RELOADING;
log_struct(LOG_INFO,
- "MESSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(mid),
+ MESSAGE_ID(mid),
"UNIT=%s", u->id,
"MESSAGE=%s", buf,
NULL);
diff --git a/src/journal/journald.c b/src/journal/journald.c
index 0910d7d817..4dcf7d32c2 100644
--- a/src/journal/journald.c
+++ b/src/journal/journald.c
@@ -725,7 +725,7 @@ void server_driver_message(Server *s, sd_id128_t message_id, const char *format,
IOVEC_SET_STRING(iovec[n++], buffer);
if (!sd_id128_equal(message_id, SD_ID128_NULL)) {
- snprintf(mid, sizeof(mid), "MESSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(message_id));
+ snprintf(mid, sizeof(mid), MESSAGE_ID(message_id));
char_array_0(mid);
IOVEC_SET_STRING(iovec[n++], mid);
}
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
index cbf43fe0a0..b95cc9bfbb 100644
--- a/src/login/logind-dbus.c
+++ b/src/login/logind-dbus.c
@@ -1180,8 +1180,7 @@ static int bus_manager_log_shutdown(
q = NULL;
}
- return log_struct(LOG_NOTICE,
- "MESSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(SD_MESSAGE_SHUTDOWN),
+ return log_struct(LOG_NOTICE, MESSAGE_ID(SD_MESSAGE_SHUTDOWN),
p,
q, NULL);
}
diff --git a/src/login/logind-seat.c b/src/login/logind-seat.c
index 0ae0c520e6..470d08bc05 100644
--- a/src/login/logind-seat.c
+++ b/src/login/logind-seat.c
@@ -341,7 +341,7 @@ int seat_start(Seat *s) {
return 0;
log_struct(LOG_INFO,
- "MESSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(SD_MESSAGE_SEAT_START),
+ MESSAGE_ID(SD_MESSAGE_SEAT_START),
"SEAT_ID=%s", s->id,
"MESSAGE=New seat %s.", s->id,
NULL);
@@ -369,7 +369,7 @@ int seat_stop(Seat *s) {
if (s->started)
log_struct(LOG_INFO,
- "MESSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(SD_MESSAGE_SEAT_STOP),
+ MESSAGE_ID(SD_MESSAGE_SEAT_STOP),
"SEAT_ID=%s", s->id,
"MESSAGE=Removed seat %s.", s->id,
NULL);
diff --git a/src/login/logind-session.c b/src/login/logind-session.c
index 958b516701..5d9401b223 100644
--- a/src/login/logind-session.c
+++ b/src/login/logind-session.c
@@ -547,7 +547,7 @@ int session_start(Session *s) {
return r;
log_struct(s->type == SESSION_TTY || s->type == SESSION_X11 ? LOG_INFO : LOG_DEBUG,
- "MESSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(SD_MESSAGE_SESSION_START),
+ MESSAGE_ID(SD_MESSAGE_SESSION_START),
"SESSION_ID=%s", s->id,
"USER_ID=%s", s->user->name,
"LEADER=%lu", (unsigned long) s->leader,
@@ -689,7 +689,7 @@ int session_stop(Session *s) {
if (s->started)
log_struct(s->type == SESSION_TTY || s->type == SESSION_X11 ? LOG_INFO : LOG_DEBUG,
- "MESSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(SD_MESSAGE_SESSION_STOP),
+ MESSAGE_ID(SD_MESSAGE_SESSION_STOP),
"SESSION_ID=%s", s->id,
"USER_ID=%s", s->user->name,
"LEADER=%lu", (unsigned long) s->leader,
diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c
index 71c7518a3b..2f312675c5 100644
--- a/src/sleep/sleep.c
+++ b/src/sleep/sleep.c
@@ -69,13 +69,13 @@ int main(int argc, char *argv[]) {
if (streq(argv[1], "suspend"))
log_struct(LOG_INFO,
- "MESSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(SD_MESSAGE_SLEEP_START),
+ MESSAGE_ID(SD_MESSAGE_SLEEP_START),
"MESSAGE=Suspending system...",
"SLEEP=suspend",
NULL);
else
log_struct(LOG_INFO,
- "MESSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(SD_MESSAGE_SLEEP_START),
+ MESSAGE_ID(SD_MESSAGE_SLEEP_START),
"MESSAGE=Hibernating system...",
"SLEEP=hibernate",
NULL);
@@ -88,13 +88,13 @@ int main(int argc, char *argv[]) {
if (streq(argv[1], "suspend"))
log_struct(LOG_INFO,
- "MESSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(SD_MESSAGE_SLEEP_STOP),
+ MESSAGE_ID(SD_MESSAGE_SLEEP_STOP),
"MESSAGE=System resumed.",
"SLEEP=suspend",
NULL);
else
log_struct(LOG_INFO,
- "MESSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(SD_MESSAGE_SLEEP_STOP),
+ MESSAGE_ID(SD_MESSAGE_SLEEP_STOP),
"MESSAGE=System thawed.",
"SLEEP=hibernate",
NULL);
diff --git a/src/systemd/sd-id128.h b/src/systemd/sd-id128.h
index 05521ae4bb..fa17be8434 100644
--- a/src/systemd/sd-id128.h
+++ b/src/systemd/sd-id128.h
@@ -65,6 +65,7 @@ static inline int sd_id128_equal(sd_id128_t a, sd_id128_t b) {
}
#define SD_ID128_NULL ((sd_id128_t) { .qwords = { 0, 0 }})
+#define MESSAGE_ID(x) "MESSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(x)
#ifdef __cplusplus
}
diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c
index 8c589ba30e..40ba255090 100644
--- a/src/timedate/timedated.c
+++ b/src/timedate/timedated.c
@@ -701,7 +701,7 @@ static DBusHandlerResult timedate_message_handler(
}
log_struct(LOG_INFO,
- "MESSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(SD_MESSAGE_TIMEZONE_CHANGE),
+ MESSAGE_ID(SD_MESSAGE_TIMEZONE_CHANGE),
"TIMEZONE=%s", tz.zone,
"MESSAGE=Changed timezone to '%s'.", tz.zone,
NULL);
@@ -843,7 +843,7 @@ static DBusHandlerResult timedate_message_handler(
hwclock_set_time(tm);
log_struct(LOG_INFO,
- "MESSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(SD_MESSAGE_TIME_CHANGE),
+ MESSAGE_ID(SD_MESSAGE_TIME_CHANGE),
"REALTIME=%llu", (unsigned long long) timespec_load(&ts),
"MESSAGE=Changed local time to %s", ctime(&ts.tv_sec),
NULL);