From 9a710fe17f1bfec7cc2d11557c5bf0983ce5e137 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Sat, 26 Dec 2020 18:49:30 +0100 Subject: [PATCH] display: fix logging --- src/display-console.cc | 3 +-- src/display-file.cc | 3 +-- src/display-http.cc | 3 +-- src/display-ncurses.cc | 3 +-- src/display-output.cc | 17 ++++++++--------- src/display-x11.cc | 3 +-- 6 files changed, 13 insertions(+), 19 deletions(-) diff --git a/src/display-console.cc b/src/display-console.cc index 04439606..dea7f8bb 100644 --- a/src/display-console.cc +++ b/src/display-console.cc @@ -55,8 +55,7 @@ display_output_console::display_output_console(const std::string &name_) bool display_output_console::detect() { if ((out_to_stdout.get(*state) || out_to_stderr.get(*state)) && !out_to_ncurses.get(*state)) { - std::cerr << "Display output '" << name << "' enabled in config." - << std::endl; + DBGP2("Display output '%s' enabled in config.", name.c_str()); return true; } return false; diff --git a/src/display-file.cc b/src/display-file.cc index 33c1ff55..28dfe35e 100644 --- a/src/display-file.cc +++ b/src/display-file.cc @@ -61,8 +61,7 @@ display_output_file::display_output_file(const std::string &name_) bool display_output_file::detect() { if (static_cast(!overwrite_file.get(*state).empty()) != 0u || static_cast(!append_file.get(*state).empty()) != 0u) { - std::cerr << "Display output '" << name << "' enabled in config." - << std::endl; + DBGP2("Display output '%s' enabled in config.", name.c_str()); return true; } return false; diff --git a/src/display-http.cc b/src/display-http.cc index 8e0d327c..2b00deed 100644 --- a/src/display-http.cc +++ b/src/display-http.cc @@ -133,8 +133,7 @@ display_output_http::display_output_http() : display_output_base("http") { bool display_output_http::detect() { if (/*priv::*/ out_to_http.get(*state)) { - std::cerr << "Display output '" << name << "' enabled in config." - << std::endl; + DBGP2("Display output '%s' enabled in config.", name.c_str()); return true; } return false; diff --git a/src/display-ncurses.cc b/src/display-ncurses.cc index ab39cbfc..0208d8b3 100644 --- a/src/display-ncurses.cc +++ b/src/display-ncurses.cc @@ -66,8 +66,7 @@ display_output_ncurses::display_output_ncurses() bool display_output_ncurses::detect() { if (out_to_ncurses.get(*state)) { - std::cerr << "Display output '" << name << "' enabled in config." - << std::endl; + DBGP2("Display output '%s' enabled in config.", name.c_str()); return true; } return false; diff --git a/src/display-output.cc b/src/display-output.cc index ddbdef62..fec72189 100644 --- a/src/display-output.cc +++ b/src/display-output.cc @@ -27,6 +27,7 @@ #include #include "display-output.hh" +#include "logging.h" #include #include @@ -91,9 +92,10 @@ disabled_display_output::disabled_display_output(const std::string &name, : display_output_base(name) { priority = -2; // XXX some generic way of reporting errors? NORM_ERR? - std::cerr << "Support for display output '" << name - << "' has been disabled during compilation. Please recompile with '" - << define << "'" << std::endl; + DBGP( + "Support for display output '%s' has been disabled during compilation. " + "Please recompile with '%s'", + name.c_str(), define.c_str()); } bool initialize_display_outputs() { @@ -108,11 +110,9 @@ bool initialize_display_outputs() { for (auto output : outputs) { if (output->priority < 0) continue; - std::cerr << "Testing display output '" << output->name << "'... " - << std::endl; + DBGP2("Testing display output '%s'... ", output->name.c_str()); if (output->detect()) { - std::cerr << "Detected display output '" << output->name << "'... " - << std::endl; + DBGP2("Detected display output '%s'... ", output->name.c_str()); if (graphical_count && output->graphical()) continue; @@ -120,8 +120,7 @@ bool initialize_display_outputs() { active_display_outputs.push_back(output); if (output->initialize()) { - std::cerr << "Initialized display output '" << output->name << "'... " - << std::endl; + DBGP("Initialized display output '%s'... ", output->name.c_str()); output->is_active = true; if (output->graphical()) graphical_count++; diff --git a/src/display-x11.cc b/src/display-x11.cc index 196f66db..de9d3b8c 100644 --- a/src/display-x11.cc +++ b/src/display-x11.cc @@ -205,8 +205,7 @@ display_output_x11::display_output_x11() : display_output_base("x11") { bool display_output_x11::detect() { if (out_to_x.get(*state)) { - std::cerr << "Display output '" << name << "' enabled in config." - << std::endl; + DBGP2("Display output '%s' enabled in config.", name.c_str()); return true; } return false;