From f9304e6c10713f713a17f280507f045451863246 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Sat, 3 Jan 2015 22:10:33 +0100 Subject: [PATCH] Print non-errors to stdout --- kernel/driver.cc | 6 ++++-- kernel/log.cc | 6 ++++++ kernel/log.h | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/kernel/driver.cc b/kernel/driver.cc index f1bf0657b..2cbdba8f3 100644 --- a/kernel/driver.cc +++ b/kernel/driver.cc @@ -268,8 +268,10 @@ int main(int argc, char **argv) } } - if (log_errfile == NULL) - log_files.push_back(stderr); + if (log_errfile == NULL) { + log_files.push_back(stdout); + log_error_stderr = true; + } if (print_banner) { log("\n"); diff --git a/kernel/log.cc b/kernel/log.cc index b984f0112..2be425ffd 100644 --- a/kernel/log.cc +++ b/kernel/log.cc @@ -44,6 +44,7 @@ FILE *log_errfile = NULL; SHA1 *log_hasher = NULL; bool log_time = false; +bool log_error_stderr = false; bool log_cmd_error_throw = false; bool log_quiet_warnings = false; int log_verbose_level; @@ -175,6 +176,11 @@ void logv_error(const char *format, va_list ap) if (log_errfile != NULL) log_files.push_back(log_errfile); + if (log_error_stderr) + for (auto &f : log_files) + if (f == stdout) + f = stderr; + log("ERROR: "); logv(format, ap); log_flush(); diff --git a/kernel/log.h b/kernel/log.h index 8096758f6..fa02d2396 100644 --- a/kernel/log.h +++ b/kernel/log.h @@ -46,6 +46,7 @@ extern FILE *log_errfile; extern SHA1 *log_hasher; extern bool log_time; +extern bool log_error_stderr; extern bool log_cmd_error_throw; extern bool log_quiet_warnings; extern int log_verbose_level; -- 2.30.2