summaryrefslogtreecommitdiff
path: root/src/core/manager.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-08-24 22:21:20 +0200
committerLennart Poettering <lennart@poettering.net>2012-09-03 18:59:04 -0700
commit877d54e9b09e093c2102f519a84e2a52637ae035 (patch)
treeff7926d33cd29b9e2930cb401a7be412c7724241 /src/core/manager.c
parent88fae6e0441d4195e089434f07d3e7fd811d6297 (diff)
journal: generate structured journal messages for a number of events
Diffstat (limited to 'src/core/manager.c')
-rw-r--r--src/core/manager.c47
1 files changed, 32 insertions, 15 deletions
diff --git a/src/core/manager.c b/src/core/manager.c
index bcaf913b5a..da766e6d58 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -41,7 +41,9 @@
#include <libaudit.h>
#endif
-#include <systemd/sd-daemon.h>
+#include "systemd/sd-daemon.h"
+#include "systemd/sd-id128.h"
+#include "systemd/sd-messages.h"
#include "manager.h"
#include "transaction.h"
@@ -2030,26 +2032,41 @@ void manager_check_finished(Manager *m) {
kernel_usec = m->initrd_timestamp.monotonic;
initrd_usec = m->startup_timestamp.monotonic - m->initrd_timestamp.monotonic;
- log_info("Startup finished in %s (kernel) + %s (initrd) + %s (userspace) = %s.",
- format_timespan(kernel, sizeof(kernel), kernel_usec),
- format_timespan(initrd, sizeof(initrd), initrd_usec),
- format_timespan(userspace, sizeof(userspace), userspace_usec),
- format_timespan(sum, sizeof(sum), total_usec));
+ log_struct(LOG_INFO,
+ "MESSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(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,
+ "MESSAGE=Startup finished in %s (kernel) + %s (initrd) + %s (userspace) = %s.",
+ format_timespan(kernel, sizeof(kernel), kernel_usec),
+ format_timespan(initrd, sizeof(initrd), initrd_usec),
+ format_timespan(userspace, sizeof(userspace), userspace_usec),
+ format_timespan(sum, sizeof(sum), total_usec),
+ NULL);
} else {
kernel_usec = m->startup_timestamp.monotonic;
initrd_usec = 0;
- log_info("Startup finished in %s (kernel) + %s (userspace) = %s.",
- format_timespan(kernel, sizeof(kernel), kernel_usec),
- format_timespan(userspace, sizeof(userspace), userspace_usec),
- format_timespan(sum, sizeof(sum), total_usec));
+ log_struct(LOG_INFO,
+ "MESSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(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.",
+ format_timespan(kernel, sizeof(kernel), kernel_usec),
+ format_timespan(userspace, sizeof(userspace), userspace_usec),
+ format_timespan(sum, sizeof(sum), total_usec),
+ NULL);
}
} else {
- userspace_usec = initrd_usec = kernel_usec = 0;
- total_usec = m->finish_timestamp.monotonic - m->startup_timestamp.monotonic;
-
- log_debug("Startup finished in %s.",
- format_timespan(sum, sizeof(sum), total_usec));
+ initrd_usec = kernel_usec = 0;
+ total_usec = userspace_usec = m->finish_timestamp.monotonic - m->startup_timestamp.monotonic;
+
+ log_struct(LOG_INFO,
+ "MESSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(SD_MESSAGE_STARTUP_FINISHED),
+ "USERSPACE_USEC=%llu", (unsigned long long) userspace_usec,
+ "MESSAGE=Startup finished in %s.",
+ format_timespan(sum, sizeof(sum), total_usec),
+ NULL);
}
bus_broadcast_finished(m, kernel_usec, initrd_usec, userspace_usec, total_usec);