From 938bf7b8b579c04ae09373f8ff330b9646a374f7 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sun, 29 Oct 2023 15:24:27 +0100 Subject: [PATCH] Logger: go back to outputting to the console. Considering I went back to Windows, this is gonna be better than outputting to a file. --- src/Logger/Logger.cpp | 14 +++++++++++--- src/Logger/Logger.h | 4 ++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/Logger/Logger.cpp b/src/Logger/Logger.cpp index 37209c9..b550f99 100644 --- a/src/Logger/Logger.cpp +++ b/src/Logger/Logger.cpp @@ -16,10 +16,12 @@ #include +#ifndef SAVETOOL_DEBUG_BUILD #include #include -#include #include +#endif +#include #include "Logger.h" @@ -36,9 +38,9 @@ Logger::instance() { void Logger::initialise() { + #ifndef SAVETOOL_DEBUG_BUILD auto exe_path = Utility::Path::split(*Utility::Path::executableLocation()).first(); _logFile.open(Utility::Path::join(exe_path, "SaveToolLog.txt").cbegin(), std::ios::trunc); - #ifndef SAVETOOL_DEBUG_BUILD _logFile << "In case you encounter a bug:\n" << "1. Do not run the Save Tool again, as this log will be cleared.\n" << "2. Go to either the official Sekai Project Discord guild, or the community M.A.S.S. Builder one.\n" << @@ -63,7 +65,13 @@ Logger::unindent() { void Logger::log(EntryType type, StringView location, StringView message) { - Debug d{&_logFile}; + Debug d{ + #ifdef SAVETOOL_DEBUG_BUILD + &std::cout + #else + &_logFile + #endif + }; switch(type) { case EntryType::Info: diff --git a/src/Logger/Logger.h b/src/Logger/Logger.h index 86721db..409f94f 100644 --- a/src/Logger/Logger.h +++ b/src/Logger/Logger.h @@ -18,7 +18,9 @@ #include +#ifndef SAVETOOL_DEBUG_BUILD #include +#endif #include #include @@ -58,7 +60,9 @@ class Logger { private: Logger() = default; + #ifndef SAVETOOL_DEBUG_BUILD std::ofstream _logFile; + #endif std::uint32_t _indentLevel = 0;