From 6d4b06c08fb5b33c23f5820c35ac2375474e541a Mon Sep 17 00:00:00 2001 From: DrChat Date: Sat, 11 Feb 2017 00:15:52 -0600 Subject: [PATCH] Use stdout as logfile for tests --- .travis.yml | 2 +- src/xenia/base/logging.cc | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index fdbdd5cbf..113ab2f8a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -53,7 +53,7 @@ script: - ./build/bin/Linux/Debug/xenia-base-tests # Build and run ppc tests - ./xenia-build build --config=debug --target=xenia-cpu-ppc-tests - - if ! ./build/bin/Linux/Debug/xenia-cpu-ppc-tests; then cat xenia.log; fi + - ./build/bin/Linux/Debug/xenia-cpu-ppc-tests --logfile=stdout # TODO(DrChat): Enable builds in the future. # Build all of xenia. diff --git a/src/xenia/base/logging.cc b/src/xenia/base/logging.cc index b81ff0b91..cc96de309 100644 --- a/src/xenia/base/logging.cc +++ b/src/xenia/base/logging.cc @@ -33,7 +33,9 @@ #include "xenia/base/platform_win.h" #endif // XE_PLATFORM_WIN32 -DEFINE_string(log_file, "xenia.log", "Logs are written to the given file."); +DEFINE_string( + log_file, "xenia.log", + "Logs are written to the given file (specify stdout for command line)"); DEFINE_bool(log_debugprint, false, "Dump the log to DebugPrint."); DEFINE_bool(flush_log, true, "Flush log file after each log line batch."); @@ -48,9 +50,13 @@ class Logger { public: explicit Logger(const std::wstring& app_name) : running_(true) { if (!FLAGS_log_file.empty()) { - auto file_path = xe::to_wstring(FLAGS_log_file.c_str()); - xe::filesystem::CreateParentFolder(file_path); - file_ = xe::filesystem::OpenFile(file_path, "wt"); + if (FLAGS_log_file == "stdout") { + file_ = stdout; + } else { + auto file_path = xe::to_wstring(FLAGS_log_file.c_str()); + xe::filesystem::CreateParentFolder(file_path); + file_ = xe::filesystem::OpenFile(file_path, "wt"); + } } write_thread_ =