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`
This commit is contained in:
patrick96 2020-04-22 00:14:02 +02:00 committed by Patrick Ziegler
parent cae3848030
commit 3f60561ae3
7 changed files with 10 additions and 10 deletions

View File

@ -335,7 +335,7 @@ class config {
return convert<T>(move(value)); return convert<T>(move(value));
} catch (const xresource_error& err) { } catch (const xresource_error& err) {
if (has_fallback) { 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<T>(move(fallback)); return convert<T>(move(fallback));
} }
throw value_error(sstream() << err.what() << " (no fallback set)"); throw value_error(sstream() << err.what() << " (no fallback set)");
@ -364,7 +364,7 @@ class config {
m_log.info("File reference \"%s\" found", var); m_log.info("File reference \"%s\" found", var);
return convert<T>(string_util::trim(file_util::contents(var), '\n')); return convert<T>(string_util::trim(file_util::contents(var), '\n'));
} else if (has_fallback) { } 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<T>(move(fallback)); return convert<T>(move(fallback));
} else { } else {
throw value_error(sstream() << "The file \"" << var << "\" does not exist (no fallback set)"); throw value_error(sstream() << "The file \"" << var << "\" does not exist (no fallback set)");

View File

@ -68,7 +68,7 @@ namespace modules {
template <typename Impl> template <typename Impl>
void module<Impl>::halt(string error_message) { void module<Impl>::halt(string error_message) {
m_log.err("%s: %s", name(), error_message); m_log.err("%s: %s", name(), error_message);
m_log.warn("Stopping '%s'...", name()); m_log.notice("Stopping '%s'...", name());
stop(); stop();
} }

View File

@ -59,7 +59,7 @@ pulseaudio::pulseaudio(const logger& logger, string&& sink_name, bool max_volume
// get the sink index // get the sink index
op = pa_context_get_sink_info_by_name(m_context, DEFAULT_SINK, sink_info_callback, this); op = pa_context_get_sink_info_by_name(m_context, DEFAULT_SINK, sink_info_callback, this);
wait_loop(op, m_mainloop); 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 { } else {
m_log.trace("pulseaudio: using sink %s", s_name); 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); o = pa_context_get_sink_info_by_name(m_context, DEFAULT_SINK, sink_info_callback, this);
wait_loop(o, m_mainloop); wait_loop(o, m_mainloop);
if (spec_s_name != s_name) 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; break;
default: default:
break; break;
@ -189,7 +189,7 @@ void pulseaudio::inc_volume(int delta_perc) {
// avoid rounding errors and set to m_max_volume directly // avoid rounding errors and set to m_max_volume directly
pa_cvolume_scale(&cv, m_max_volume); pa_cvolume_scale(&cv, m_max_volume);
} else { } else {
m_log.warn("pulseaudio: maximum volume reached"); m_log.notice("pulseaudio: maximum volume reached");
} }
} else } else
pa_cvolume_dec(&cv, vol); pa_cvolume_dec(&cv, vol);

View File

@ -173,7 +173,7 @@ bool controller::run(bool writeback, string snapshot_dst) {
m_event_thread.join(); m_event_thread.join();
} }
m_log.warn("Termination signal received, shutting down..."); m_log.notice("Termination signal received, shutting down...");
return !g_reload; return !g_reload;
} }

View File

@ -107,7 +107,7 @@ void screen::handle(const evt::randr_screen_change_notify& evt) {
} }
if (changed) { 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_sig.emit(exit_reload{});
m_sigraised = true; m_sigraised = true;
} }

View File

@ -148,7 +148,7 @@ namespace modules {
bool bspwm_module::has_event() { bool bspwm_module::has_event() {
if (m_subscriber->poll(POLLHUP, 0)) { 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(); m_subscriber = bspwm_util::make_subscriber();
} }
return m_subscriber->peek(1); return m_subscriber->peek(1);

View File

@ -916,7 +916,7 @@ void tray_manager::handle(const evt::client_message& evt) {
if (!m_activated) { if (!m_activated) {
return; return;
} else if (evt->type == WM_PROTOCOLS && evt->data.data32[0] == WM_DELETE_WINDOW && evt->window == m_tray) { } 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; m_tray = 0;
deactivate(); deactivate();
} else if (evt->type == _NET_SYSTEM_TRAY_OPCODE && evt->format == 32) { } else if (evt->type == _NET_SYSTEM_TRAY_OPCODE && evt->format == 32) {