summaryrefslogtreecommitdiff
path: root/src/sleep
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/sleep
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/sleep')
-rw-r--r--src/sleep/sleep.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c
index ca00eea4ab..0d7c1e3fbe 100644
--- a/src/sleep/sleep.c
+++ b/src/sleep/sleep.c
@@ -88,10 +88,16 @@ static int write_state(FILE **f, char **states) {
}
static int execute(char **modes, char **states) {
- char* arguments[4];
+
+ char *arguments[] = {
+ NULL,
+ (char*) "pre",
+ arg_verb,
+ NULL
+ };
+
int r;
_cleanup_fclose_ FILE *f = NULL;
- const char* note = strappenda("SLEEP=", arg_verb);
/* This file is opened first, so that if we hit an error,
* we can abort before modifying any state. */
@@ -106,16 +112,12 @@ static int execute(char **modes, char **states) {
if (r < 0)
return r;
- arguments[0] = NULL;
- arguments[1] = (char*) "pre";
- arguments[2] = arg_verb;
- arguments[3] = NULL;
execute_directory(SYSTEM_SLEEP_PATH, NULL, DEFAULT_TIMEOUT_USEC, arguments);
log_struct(LOG_INFO,
- MESSAGE_ID(SD_MESSAGE_SLEEP_START),
- "MESSAGE=Suspending system...",
- note,
+ LOG_MESSAGE_ID(SD_MESSAGE_SLEEP_START),
+ LOG_MESSAGE("Suspending system..."),
+ "SLEEP=%s", arg_verb,
NULL);
r = write_state(&f, states);
@@ -123,9 +125,9 @@ static int execute(char **modes, char **states) {
return r;
log_struct(LOG_INFO,
- MESSAGE_ID(SD_MESSAGE_SLEEP_STOP),
- "MESSAGE=System resumed.",
- note,
+ LOG_MESSAGE_ID(SD_MESSAGE_SLEEP_STOP),
+ LOG_MESSAGE("MESSAGE=System resumed."),
+ "SLEEP=%s", arg_verb,
NULL);
arguments[1] = (char*) "post";