From 17921823e08681f4bfc5dfded7bb258306766bef Mon Sep 17 00:00:00 2001 From: Michael Carlberg Date: Fri, 28 Oct 2016 18:58:10 +0200 Subject: [PATCH] fix(controller): Change verbosity of shutdown logging --- include/components/bar.hpp | 4 ++-- include/components/controller.hpp | 30 ++++++++++++++++++------------ include/components/logger.hpp | 2 +- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/include/components/bar.hpp b/include/components/bar.hpp index 570bc798..1292ec32 100644 --- a/include/components/bar.hpp +++ b/include/components/bar.hpp @@ -610,8 +610,8 @@ class bar : public xpp::event::sink(action.button)); m_log.trace_x("action.start_x = %i", action.start_x); m_log.trace_x("action.end_x = %i", action.end_x); diff --git a/include/components/controller.hpp b/include/components/controller.hpp index e1c00ceb..784eb544 100644 --- a/include/components/controller.hpp +++ b/include/components/controller.hpp @@ -74,7 +74,7 @@ class controller { std::lock_guard guard(m_mutex, std::adopt_lock); - m_log.trace("controller: Stop modules"); + m_log.info("Stopping modules"); for (auto&& block : m_modules) { for (auto&& module : block.second) { module->stop(); @@ -86,30 +86,35 @@ class controller { m_command->terminate(); } - m_log.trace("controller: Deconstruct bar instance"); - g_signals::bar::action_click = nullptr; - m_bar.reset(); + if (m_traymanager) + m_traymanager.reset(); - m_log.trace("controller: Interrupt X event loop"); + if (m_bar) { + m_log.trace("controller: Deconstruct bar instance"); + g_signals::bar::action_click = nullptr; + m_bar.reset(); + } + + m_log.info("Interrupting X event loop"); m_connection.send_dummy_event(m_connection.root()); if (m_confwatch) { try { - m_log.trace("controller: Remove config watch"); + m_log.info("Removing config watch"); m_confwatch->remove(); } catch (const system_error& err) { } } if (!m_threads.empty()) { - m_log.trace("controller: Join active threads"); + m_log.info("Joining active threads"); for (auto&& thread : m_threads) { if (thread.joinable()) thread.join(); } } - m_log.trace("controller: Wait for spawned processes"); + m_log.info("Waiting for spawned processes"); while (process_util::notify_childprocess()) ; @@ -178,7 +183,7 @@ class controller { } } catch (const std::exception& err) { m_log.err(err.what()); - m_log.warn("controller: Disabling tray..."); + m_log.warn("Failed to setup tray, disabling..."); m_traymanager.reset(); } @@ -198,7 +203,7 @@ class controller { auto run() { assert(!m_connection.connection_has_error()); - m_log.info("Starting application..."); + m_log.info("Starting application"); m_running = true; install_sigmask(); @@ -234,7 +239,8 @@ class controller { m_traymanager->activate(); } catch (const std::exception& err) { m_log.err(err.what()); - m_log.err("controller: Failed to activate tray manager..."); + m_log.err("Failed to activate tray manager, disabling..."); + m_traymanager.reset(); } } @@ -318,7 +324,7 @@ class controller { if (!m_running) return; - m_log.info("Configuration file changed..."); + m_log.info("Configuration file changed"); kill(getpid(), SIGUSR1); } catch (const system_error& err) { m_log.err(err.what()); diff --git a/include/components/logger.hpp b/include/components/logger.hpp index 92978d82..3aa756e0 100644 --- a/include/components/logger.hpp +++ b/include/components/logger.hpp @@ -42,7 +42,7 @@ class logger { // clang-format off m_prefixes[loglevel::TRACE] = "\r\033[0;90m- "; m_prefixes[loglevel::INFO] = "\r\033[1;32m* \033[0m"; - m_prefixes[loglevel::WARNING] = "\r\033[1;33mwarning: \033[0m"; + m_prefixes[loglevel::WARNING] = "\r\033[1;33mwarn: \033[0m"; m_prefixes[loglevel::ERROR] = "\r\033[1;31merror: \033[0m"; m_suffixes[loglevel::TRACE] = "\033[0m";