diff options
| author | DrChat <arkolbed@gmail.com> | 2017-12-16 11:06:46 -0600 |
|---|---|---|
| committer | DrChat <arkolbed@gmail.com> | 2017-12-16 11:06:46 -0600 |
| commit | 293878cd14636e1eaf305768a141bc4a65dfc79e (patch) | |
| tree | 2746cbe411ad2c6700289d6e7991de488af0d8ce | |
| parent | bf9fa02b18f7920f21dd126957ea174f72816c84 (diff) | |
Use the app name as a default logfile.
| -rw-r--r-- | src/xenia/base/logging.cc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/xenia/base/logging.cc b/src/xenia/base/logging.cc index 641a97e9d..bb2af1121 100644 --- a/src/xenia/base/logging.cc +++ b/src/xenia/base/logging.cc @@ -34,7 +34,7 @@ #endif // XE_PLATFORM_WIN32 DEFINE_string( - log_file, "xenia.log", + log_file, "", "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."); @@ -52,7 +52,12 @@ thread_local std::vector<char> log_format_buffer_(64 * 1024); class Logger { public: explicit Logger(const std::wstring& app_name) : running_(true) { - if (!FLAGS_log_file.empty()) { + if (FLAGS_log_file.empty()) { + // Default to app name. + auto file_path = app_name + L".log"; + xe::filesystem::CreateParentFolder(file_path); + file_ = xe::filesystem::OpenFile(file_path, "wt"); + } else { if (FLAGS_log_file == "stdout") { file_ = stdout; } else { |
