summaryrefslogtreecommitdiff
path: root/src/sleep
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/sleep
parent88fae6e0441d4195e089434f07d3e7fd811d6297 (diff)
journal: generate structured journal messages for a number of events
Diffstat (limited to 'src/sleep')
-rw-r--r--src/sleep/sleep.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c
index c86f69c4a..71c7518a3 100644
--- a/src/sleep/sleep.c
+++ b/src/sleep/sleep.c
@@ -25,6 +25,8 @@
#include "log.h"
#include "util.h"
+#include "systemd/sd-id128.h"
+#include "systemd/sd-messages.h"
int main(int argc, char *argv[]) {
const char *verb;
@@ -66,9 +68,17 @@ int main(int argc, char *argv[]) {
execute_directory(SYSTEM_SLEEP_PATH, NULL, arguments);
if (streq(argv[1], "suspend"))
- log_info("Suspending system...");
+ log_struct(LOG_INFO,
+ "MESSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(SD_MESSAGE_SLEEP_START),
+ "MESSAGE=Suspending system...",
+ "SLEEP=suspend",
+ NULL);
else
- log_info("Hibernating system...");
+ log_struct(LOG_INFO,
+ "MESSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(SD_MESSAGE_SLEEP_START),
+ "MESSAGE=Hibernating system...",
+ "SLEEP=hibernate",
+ NULL);
fputs(verb, f);
fputc('\n', f);
@@ -77,9 +87,17 @@ int main(int argc, char *argv[]) {
r = ferror(f) ? -errno : 0;
if (streq(argv[1], "suspend"))
- log_info("System resumed.");
+ log_struct(LOG_INFO,
+ "MESSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(SD_MESSAGE_SLEEP_STOP),
+ "MESSAGE=System resumed.",
+ "SLEEP=suspend",
+ NULL);
else
- log_info("System thawed.");
+ log_struct(LOG_INFO,
+ "MESSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(SD_MESSAGE_SLEEP_STOP),
+ "MESSAGE=System thawed.",
+ "SLEEP=hibernate",
+ NULL);
arguments[1] = (char*) "post";
execute_directory(SYSTEM_SLEEP_PATH, NULL, arguments);