From 3f60561ae3185b8753d9c5e3a9736f554786aea7 Mon Sep 17 00:00:00 2001
From: patrick96
Date: Wed, 22 Apr 2020 00:14:02 +0200
Subject: [PATCH] logger: Downgrade some warning messages
A warning implies something went wrong and (possibly) the user should do
something about it. However, warnings are not always used this way.
For example:
* When a fallback value for a `${..}` reference is used, this shouldn't
produce a warning (or notice) since using fallbacks is not something
bad.
* pulse telling you that it uses the default sink because no sink was
specified also does not warrant a warning (even notice may be too
high).
* Whenever polybar shuts down it produces a "Termination signal
received..." warning. Since there isn't a more proper way to shut down
polybar, it should not produce a warning. Same argument for a
`screenchange-reload`
---
include/components/config.hpp | 4 ++--
include/modules/meta/base.inl | 2 +-
src/adapters/pulseaudio.cpp | 6 +++---
src/components/controller.cpp | 2 +-
src/components/screen.cpp | 2 +-
src/modules/bspwm.cpp | 2 +-
src/x11/tray_manager.cpp | 2 +-
7 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/include/components/config.hpp b/include/components/config.hpp
index b3d0c1ee..9c15f13e 100644
--- a/include/components/config.hpp
+++ b/include/components/config.hpp
@@ -335,7 +335,7 @@ class config {
return convert(move(value));
} catch (const xresource_error& err) {
if (has_fallback) {
- m_log.warn("%s, using defined fallback value \"%s\"", err.what(), fallback);
+ m_log.info("%s, using defined fallback value \"%s\"", err.what(), fallback);
return convert(move(fallback));
}
throw value_error(sstream() << err.what() << " (no fallback set)");
@@ -364,7 +364,7 @@ class config {
m_log.info("File reference \"%s\" found", var);
return convert(string_util::trim(file_util::contents(var), '\n'));
} else if (has_fallback) {
- m_log.warn("File reference \"%s\" not found, using defined fallback value \"%s\"", var, fallback);
+ m_log.info("File reference \"%s\" not found, using defined fallback value \"%s\"", var, fallback);
return convert(move(fallback));
} else {
throw value_error(sstream() << "The file \"" << var << "\" does not exist (no fallback set)");
diff --git a/include/modules/meta/base.inl b/include/modules/meta/base.inl
index ec68d5ab..d7e96312 100644
--- a/include/modules/meta/base.inl
+++ b/include/modules/meta/base.inl
@@ -68,7 +68,7 @@ namespace modules {
template
void module::halt(string error_message) {
m_log.err("%s: %s", name(), error_message);
- m_log.warn("Stopping '%s'...", name());
+ m_log.notice("Stopping '%s'...", name());
stop();
}
diff --git a/src/adapters/pulseaudio.cpp b/src/adapters/pulseaudio.cpp
index 666bf5d7..9f0c1b3c 100644
--- a/src/adapters/pulseaudio.cpp
+++ b/src/adapters/pulseaudio.cpp
@@ -59,7 +59,7 @@ pulseaudio::pulseaudio(const logger& logger, string&& sink_name, bool max_volume
// get the sink index
op = pa_context_get_sink_info_by_name(m_context, DEFAULT_SINK, sink_info_callback, this);
wait_loop(op, m_mainloop);
- m_log.warn("pulseaudio: using default sink %s", s_name);
+ m_log.notice("pulseaudio: using default sink %s", s_name);
} else {
m_log.trace("pulseaudio: using sink %s", s_name);
}
@@ -134,7 +134,7 @@ int pulseaudio::process_events() {
o = pa_context_get_sink_info_by_name(m_context, DEFAULT_SINK, sink_info_callback, this);
wait_loop(o, m_mainloop);
if (spec_s_name != s_name)
- m_log.warn("pulseaudio: using default sink %s", s_name);
+ m_log.notice("pulseaudio: using default sink %s", s_name);
break;
default:
break;
@@ -189,7 +189,7 @@ void pulseaudio::inc_volume(int delta_perc) {
// avoid rounding errors and set to m_max_volume directly
pa_cvolume_scale(&cv, m_max_volume);
} else {
- m_log.warn("pulseaudio: maximum volume reached");
+ m_log.notice("pulseaudio: maximum volume reached");
}
} else
pa_cvolume_dec(&cv, vol);
diff --git a/src/components/controller.cpp b/src/components/controller.cpp
index d7507de0..d98cd9fd 100644
--- a/src/components/controller.cpp
+++ b/src/components/controller.cpp
@@ -173,7 +173,7 @@ bool controller::run(bool writeback, string snapshot_dst) {
m_event_thread.join();
}
- m_log.warn("Termination signal received, shutting down...");
+ m_log.notice("Termination signal received, shutting down...");
return !g_reload;
}
diff --git a/src/components/screen.cpp b/src/components/screen.cpp
index b52be580..03ce8a22 100644
--- a/src/components/screen.cpp
+++ b/src/components/screen.cpp
@@ -107,7 +107,7 @@ void screen::handle(const evt::randr_screen_change_notify& evt) {
}
if (changed) {
- m_log.warn("randr_screen_change_notify (%ux%u)... reloading", evt->width, evt->height);
+ m_log.notice("randr_screen_change_notify (%ux%u)... reloading", evt->width, evt->height);
m_sig.emit(exit_reload{});
m_sigraised = true;
}
diff --git a/src/modules/bspwm.cpp b/src/modules/bspwm.cpp
index 3d145f64..af120c8c 100644
--- a/src/modules/bspwm.cpp
+++ b/src/modules/bspwm.cpp
@@ -148,7 +148,7 @@ namespace modules {
bool bspwm_module::has_event() {
if (m_subscriber->poll(POLLHUP, 0)) {
- m_log.warn("%s: Reconnecting to socket...", name());
+ m_log.notice("%s: Reconnecting to socket...", name());
m_subscriber = bspwm_util::make_subscriber();
}
return m_subscriber->peek(1);
diff --git a/src/x11/tray_manager.cpp b/src/x11/tray_manager.cpp
index da2793b4..f9da35fe 100644
--- a/src/x11/tray_manager.cpp
+++ b/src/x11/tray_manager.cpp
@@ -916,7 +916,7 @@ void tray_manager::handle(const evt::client_message& evt) {
if (!m_activated) {
return;
} else if (evt->type == WM_PROTOCOLS && evt->data.data32[0] == WM_DELETE_WINDOW && evt->window == m_tray) {
- m_log.warn("Received WM_DELETE");
+ m_log.notice("Received WM_DELETE");
m_tray = 0;
deactivate();
} else if (evt->type == _NET_SYSTEM_TRAY_OPCODE && evt->format == 32) {