diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-11-28 02:05:14 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-11-28 02:18:46 +0100 |
commit | e2cc6eca73cd1df8be552d7c23f9ff3d69c06f1e (patch) | |
tree | 874e0dac2d1426e44c3e748734cbb297f3feefa8 /src/login | |
parent | 6c861f0aeff9449ee1201bb56f89861921e41c45 (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/login')
-rw-r--r-- | src/login/logind-button.c | 28 | ||||
-rw-r--r-- | src/login/logind-dbus.c | 6 | ||||
-rw-r--r-- | src/login/logind-seat.c | 8 | ||||
-rw-r--r-- | src/login/logind-session.c | 8 |
4 files changed, 26 insertions, 24 deletions
diff --git a/src/login/logind-button.c b/src/login/logind-button.c index 57e619efe6..e380dc0611 100644 --- a/src/login/logind-button.c +++ b/src/login/logind-button.c @@ -159,8 +159,8 @@ static int button_dispatch(sd_event_source *s, int fd, uint32_t revents, void *u case KEY_POWER: case KEY_POWER2: log_struct(LOG_INFO, - "MESSAGE=Power key pressed.", - MESSAGE_ID(SD_MESSAGE_POWER_KEY), + LOG_MESSAGE("Power key pressed."), + LOG_MESSAGE_ID(SD_MESSAGE_POWER_KEY), NULL); manager_handle_action(b->manager, INHIBIT_HANDLE_POWER_KEY, b->manager->handle_power_key, b->manager->power_key_ignore_inhibited, true); @@ -174,8 +174,8 @@ static int button_dispatch(sd_event_source *s, int fd, uint32_t revents, void *u case KEY_SLEEP: log_struct(LOG_INFO, - "MESSAGE=Suspend key pressed.", - MESSAGE_ID(SD_MESSAGE_SUSPEND_KEY), + LOG_MESSAGE("Suspend key pressed."), + LOG_MESSAGE_ID(SD_MESSAGE_SUSPEND_KEY), NULL); manager_handle_action(b->manager, INHIBIT_HANDLE_SUSPEND_KEY, b->manager->handle_suspend_key, b->manager->suspend_key_ignore_inhibited, true); @@ -183,8 +183,8 @@ static int button_dispatch(sd_event_source *s, int fd, uint32_t revents, void *u case KEY_SUSPEND: log_struct(LOG_INFO, - "MESSAGE=Hibernate key pressed.", - MESSAGE_ID(SD_MESSAGE_HIBERNATE_KEY), + LOG_MESSAGE("Hibernate key pressed."), + LOG_MESSAGE_ID(SD_MESSAGE_HIBERNATE_KEY), NULL); manager_handle_action(b->manager, INHIBIT_HANDLE_HIBERNATE_KEY, b->manager->handle_hibernate_key, b->manager->hibernate_key_ignore_inhibited, true); @@ -195,8 +195,8 @@ static int button_dispatch(sd_event_source *s, int fd, uint32_t revents, void *u if (ev.code == SW_LID) { log_struct(LOG_INFO, - "MESSAGE=Lid closed.", - MESSAGE_ID(SD_MESSAGE_LID_CLOSED), + LOG_MESSAGE("Lid closed."), + LOG_MESSAGE_ID(SD_MESSAGE_LID_CLOSED), NULL); b->lid_closed = true; @@ -205,8 +205,8 @@ static int button_dispatch(sd_event_source *s, int fd, uint32_t revents, void *u } else if (ev.code == SW_DOCK) { log_struct(LOG_INFO, - "MESSAGE=System docked.", - MESSAGE_ID(SD_MESSAGE_SYSTEM_DOCKED), + LOG_MESSAGE("System docked."), + LOG_MESSAGE_ID(SD_MESSAGE_SYSTEM_DOCKED), NULL); b->docked = true; @@ -216,8 +216,8 @@ static int button_dispatch(sd_event_source *s, int fd, uint32_t revents, void *u if (ev.code == SW_LID) { log_struct(LOG_INFO, - "MESSAGE=Lid opened.", - MESSAGE_ID(SD_MESSAGE_LID_OPENED), + LOG_MESSAGE("Lid opened."), + LOG_MESSAGE_ID(SD_MESSAGE_LID_OPENED), NULL); b->lid_closed = false; @@ -225,8 +225,8 @@ static int button_dispatch(sd_event_source *s, int fd, uint32_t revents, void *u } else if (ev.code == SW_DOCK) { log_struct(LOG_INFO, - "MESSAGE=System undocked.", - MESSAGE_ID(SD_MESSAGE_SYSTEM_UNDOCKED), + LOG_MESSAGE("System undocked."), + LOG_MESSAGE_ID(SD_MESSAGE_SYSTEM_UNDOCKED), NULL); b->docked = false; diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c index f18d21055a..d225ba1619 100644 --- a/src/login/logind-dbus.c +++ b/src/login/logind-dbus.c @@ -1300,9 +1300,11 @@ static int bus_manager_log_shutdown( q = NULL; } - return log_struct(LOG_NOTICE, MESSAGE_ID(SD_MESSAGE_SHUTDOWN), + return log_struct(LOG_NOTICE, + LOG_MESSAGE_ID(SD_MESSAGE_SHUTDOWN), p, - q, NULL); + q, + NULL); } static int lid_switch_ignore_handler(sd_event_source *e, uint64_t usec, void *userdata) { diff --git a/src/login/logind-seat.c b/src/login/logind-seat.c index 9992195151..709c6385e6 100644 --- a/src/login/logind-seat.c +++ b/src/login/logind-seat.c @@ -400,9 +400,9 @@ int seat_start(Seat *s) { return 0; log_struct(LOG_INFO, - MESSAGE_ID(SD_MESSAGE_SEAT_START), + LOG_MESSAGE_ID(SD_MESSAGE_SEAT_START), "SEAT_ID=%s", s->id, - "MESSAGE=New seat %s.", s->id, + LOG_MESSAGE("New seat %s.", s->id), NULL); /* Initialize VT magic stuff */ @@ -428,9 +428,9 @@ int seat_stop(Seat *s, bool force) { if (s->started) log_struct(LOG_INFO, - MESSAGE_ID(SD_MESSAGE_SEAT_STOP), + LOG_MESSAGE_ID(SD_MESSAGE_SEAT_STOP), "SEAT_ID=%s", s->id, - "MESSAGE=Removed seat %s.", s->id, + LOG_MESSAGE("Removed seat %s.", s->id), NULL); seat_stop_sessions(s, force); diff --git a/src/login/logind-session.c b/src/login/logind-session.c index 65bbb77750..c4fe53bc61 100644 --- a/src/login/logind-session.c +++ b/src/login/logind-session.c @@ -549,11 +549,11 @@ int session_start(Session *s) { return r; log_struct(s->class == SESSION_BACKGROUND ? LOG_DEBUG : LOG_INFO, - MESSAGE_ID(SD_MESSAGE_SESSION_START), + LOG_MESSAGE_ID(SD_MESSAGE_SESSION_START), "SESSION_ID=%s", s->id, "USER_ID=%s", s->user->name, "LEADER="PID_FMT, s->leader, - "MESSAGE=New session %s of user %s.", s->id, s->user->name, + LOG_MESSAGE("New session %s of user %s.", s->id, s->user->name), NULL); if (!dual_timestamp_is_set(&s->timestamp)) @@ -652,11 +652,11 @@ int session_finalize(Session *s) { if (s->started) log_struct(s->class == SESSION_BACKGROUND ? LOG_DEBUG : LOG_INFO, - MESSAGE_ID(SD_MESSAGE_SESSION_STOP), + LOG_MESSAGE_ID(SD_MESSAGE_SESSION_STOP), "SESSION_ID=%s", s->id, "USER_ID=%s", s->user->name, "LEADER="PID_FMT, s->leader, - "MESSAGE=Removed session %s.", s->id, + LOG_MESSAGE("Removed session %s.", s->id), NULL); s->timer_event_source = sd_event_source_unref(s->timer_event_source); |