From 76b6f3f68f133ae017e577219244b02e1c361446 Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: Tue, 8 Dec 2015 18:23:39 -0500 Subject: manager: move status output change debug messages to set function This way we can only print the debug message when the status actually changes. We also means we don't print anything when running in --user mode, where status output is always disabled. --- src/core/manager.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/core') diff --git a/src/core/manager.c b/src/core/manager.c index 34dd715e93..9f65e0ff32 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -1885,12 +1885,10 @@ static int manager_dispatch_signal_fd(sd_event_source *source, int fd, uint32_t switch (sfsi.ssi_signo - SIGRTMIN) { case 20: - log_debug("Enabling showing of status."); manager_set_show_status(m, SHOW_STATUS_YES); break; case 21: - log_debug("Disabling showing of status."); manager_set_show_status(m, SHOW_STATUS_NO); break; @@ -2961,6 +2959,9 @@ void manager_set_show_status(Manager *m, ShowStatus mode) { if (m->running_as != MANAGER_SYSTEM) return; + if (m->show_status != mode) + log_debug("%s showing of status.", + mode == SHOW_STATUS_NO ? "Disabling" : "Enabling"); m->show_status = mode; if (mode > 0) -- cgit v1.2.3-54-g00ecf From 4cee3a78bb9190a823ca08808c451daa802622e1 Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: Wed, 9 Dec 2015 21:29:38 -0500 Subject: manager: log log level changes uniformly Output the same message when a request to change the log level is received over dbus and through a signal. From the user point of view those two operations are very similar and it's easy to think that the dbus operation didn't work when the expected message is not emitted. Also "downgrade" the message level to info, since this is a normal user initiated action. --- src/core/dbus-manager.c | 5 ++++- src/core/manager.c | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'src/core') diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c index 5457b2451b..293750bbe7 100644 --- a/src/core/dbus-manager.c +++ b/src/core/dbus-manager.c @@ -229,7 +229,10 @@ static int property_set_log_level( if (r < 0) return r; - return log_set_max_level_from_string(t); + r = log_set_max_level_from_string(t); + if (r == 0) + log_info("Setting log level to %s.", t); + return r; } static int property_get_n_names( diff --git a/src/core/manager.c b/src/core/manager.c index 9f65e0ff32..e65616adc1 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -1894,12 +1894,12 @@ static int manager_dispatch_signal_fd(sd_event_source *source, int fd, uint32_t case 22: log_set_max_level(LOG_DEBUG); - log_notice("Setting log level to debug."); + log_info("Setting log level to debug."); break; case 23: log_set_max_level(LOG_INFO); - log_notice("Setting log level to info."); + log_info("Setting log level to info."); break; case 24: -- cgit v1.2.3-54-g00ecf