diff options
Diffstat (limited to 'brillo/syslog_logging.cc')
-rw-r--r-- | brillo/syslog_logging.cc | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/brillo/syslog_logging.cc b/brillo/syslog_logging.cc index 40b064a..2b35280 100644 --- a/brillo/syslog_logging.cc +++ b/brillo/syslog_logging.cc @@ -5,6 +5,7 @@ #include "brillo/syslog_logging.h" #include <syslog.h> +#include <unistd.h> #include <string> @@ -78,6 +79,8 @@ namespace brillo { void SetLogFlags(int log_flags) { s_log_to_syslog = (log_flags & kLogToSyslog) != 0; s_log_to_stderr = (log_flags & kLogToStderr) != 0; + if ((log_flags & kLogToStderrIfTty) && isatty(0)) + s_log_to_stderr = true; s_log_header = (log_flags & kLogHeader) != 0; } int GetLogFlags() { |