Use stdout as logfile for tests

This commit is contained in:
DrChat 2017-02-11 00:15:52 -06:00
parent 26456280f1
commit 6d4b06c08f
2 changed files with 11 additions and 5 deletions

View File

@ -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.

View File

@ -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_ =