1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-26 12:27:52 +00:00

display: fix logging

This commit is contained in:
François Revol 2020-12-26 18:49:30 +01:00
parent 568de329ef
commit 9a710fe17f
6 changed files with 13 additions and 19 deletions

View File

@ -55,8 +55,7 @@ display_output_console::display_output_console(const std::string &name_)
bool display_output_console::detect() { bool display_output_console::detect() {
if ((out_to_stdout.get(*state) || out_to_stderr.get(*state)) && if ((out_to_stdout.get(*state) || out_to_stderr.get(*state)) &&
!out_to_ncurses.get(*state)) { !out_to_ncurses.get(*state)) {
std::cerr << "Display output '" << name << "' enabled in config." DBGP2("Display output '%s' enabled in config.", name.c_str());
<< std::endl;
return true; return true;
} }
return false; return false;

View File

@ -61,8 +61,7 @@ display_output_file::display_output_file(const std::string &name_)
bool display_output_file::detect() { bool display_output_file::detect() {
if (static_cast<unsigned int>(!overwrite_file.get(*state).empty()) != 0u || if (static_cast<unsigned int>(!overwrite_file.get(*state).empty()) != 0u ||
static_cast<unsigned int>(!append_file.get(*state).empty()) != 0u) { static_cast<unsigned int>(!append_file.get(*state).empty()) != 0u) {
std::cerr << "Display output '" << name << "' enabled in config." DBGP2("Display output '%s' enabled in config.", name.c_str());
<< std::endl;
return true; return true;
} }
return false; return false;

View File

@ -133,8 +133,7 @@ display_output_http::display_output_http() : display_output_base("http") {
bool display_output_http::detect() { bool display_output_http::detect() {
if (/*priv::*/ out_to_http.get(*state)) { if (/*priv::*/ out_to_http.get(*state)) {
std::cerr << "Display output '" << name << "' enabled in config." DBGP2("Display output '%s' enabled in config.", name.c_str());
<< std::endl;
return true; return true;
} }
return false; return false;

View File

@ -66,8 +66,7 @@ display_output_ncurses::display_output_ncurses()
bool display_output_ncurses::detect() { bool display_output_ncurses::detect() {
if (out_to_ncurses.get(*state)) { if (out_to_ncurses.get(*state)) {
std::cerr << "Display output '" << name << "' enabled in config." DBGP2("Display output '%s' enabled in config.", name.c_str());
<< std::endl;
return true; return true;
} }
return false; return false;

View File

@ -27,6 +27,7 @@
#include <config.h> #include <config.h>
#include "display-output.hh" #include "display-output.hh"
#include "logging.h"
#include <algorithm> #include <algorithm>
#include <iostream> #include <iostream>
@ -91,9 +92,10 @@ disabled_display_output::disabled_display_output(const std::string &name,
: display_output_base(name) { : display_output_base(name) {
priority = -2; priority = -2;
// XXX some generic way of reporting errors? NORM_ERR? // XXX some generic way of reporting errors? NORM_ERR?
std::cerr << "Support for display output '" << name DBGP(
<< "' has been disabled during compilation. Please recompile with '" "Support for display output '%s' has been disabled during compilation. "
<< define << "'" << std::endl; "Please recompile with '%s'",
name.c_str(), define.c_str());
} }
bool initialize_display_outputs() { bool initialize_display_outputs() {
@ -108,11 +110,9 @@ bool initialize_display_outputs() {
for (auto output : outputs) { for (auto output : outputs) {
if (output->priority < 0) continue; if (output->priority < 0) continue;
std::cerr << "Testing display output '" << output->name << "'... " DBGP2("Testing display output '%s'... ", output->name.c_str());
<< std::endl;
if (output->detect()) { if (output->detect()) {
std::cerr << "Detected display output '" << output->name << "'... " DBGP2("Detected display output '%s'... ", output->name.c_str());
<< std::endl;
if (graphical_count && output->graphical()) continue; if (graphical_count && output->graphical()) continue;
@ -120,8 +120,7 @@ bool initialize_display_outputs() {
active_display_outputs.push_back(output); active_display_outputs.push_back(output);
if (output->initialize()) { if (output->initialize()) {
std::cerr << "Initialized display output '" << output->name << "'... " DBGP("Initialized display output '%s'... ", output->name.c_str());
<< std::endl;
output->is_active = true; output->is_active = true;
if (output->graphical()) graphical_count++; if (output->graphical()) graphical_count++;

View File

@ -205,8 +205,7 @@ display_output_x11::display_output_x11() : display_output_base("x11") {
bool display_output_x11::detect() { bool display_output_x11::detect() {
if (out_to_x.get(*state)) { if (out_to_x.get(*state)) {
std::cerr << "Display output '" << name << "' enabled in config." DBGP2("Display output '%s' enabled in config.", name.c_str());
<< std::endl;
return true; return true;
} }
return false; return false;