Skip to content
This repository has been archived by the owner on May 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1457 from doanac/logging-dest
Browse files Browse the repository at this point in the history
logging: Allow logger to use STDERR
  • Loading branch information
pattivacek authored Nov 26, 2019
2 parents 79d5a4f + 518ec50 commit 2d06138
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/libaktualizr/logging/default_log_sink.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ static void color_fmt(boost::log::record_view const& rec, boost::log::formatting
}

void logger_init_sink(bool use_colors = false) {
auto sink = boost::log::add_console_log(std::cout, boost::log::keywords::format = "%Message%",
auto stream = &std::cerr;
if (getenv("LOG_STDERR") == nullptr) {
stream = &std::cout;
}
auto sink = boost::log::add_console_log(*stream, boost::log::keywords::format = "%Message%",
boost::log::keywords::auto_flush = true);
if (use_colors) {
sink->set_formatter(&color_fmt);
Expand Down

0 comments on commit 2d06138

Please sign in to comment.