summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2015-01-03 22:10:33 +0100
committerClifford Wolf <clifford@clifford.at>2015-01-03 22:10:33 +0100
commitf9304e6c10713f713a17f280507f045451863246 (patch)
treeda6b19ac7f2a52fd89921d62047cabfbb77d3904
parent45918b8315423cb91400a0127550a1d54220c447 (diff)
Print non-errors to stdout
-rw-r--r--kernel/driver.cc6
-rw-r--r--kernel/log.cc6
-rw-r--r--kernel/log.h1
3 files changed, 11 insertions, 2 deletions
diff --git a/kernel/driver.cc b/kernel/driver.cc
index f1bf0657..2cbdba8f 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 b984f011..2be425ff 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 8096758f..fa02d239 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;