1.5: Fuckin' UE5... #38

Manually merged
williamjcm merged 126 commits from one-point-five into master 2024-07-22 11:06:13 +02:00
2 changed files with 15 additions and 3 deletions
Showing only changes of commit 938bf7b8b5 - Show all commits

View file

@ -16,10 +16,12 @@
#include <iostream>
#ifndef SAVETOOL_DEBUG_BUILD
#include <Corrade/Containers/Optional.h>
#include <Corrade/Containers/Pair.h>
#include <Corrade/Utility/Debug.h>
#include <Corrade/Utility/Path.h>
#endif
#include <Corrade/Utility/Debug.h>
#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:

View file

@ -18,7 +18,9 @@
#include <ctime>
#ifndef SAVETOOL_DEBUG_BUILD
#include <fstream>
#endif
#include <mutex>
#include <Corrade/Containers/String.h>
@ -58,7 +60,9 @@ class Logger {
private:
Logger() = default;
#ifndef SAVETOOL_DEBUG_BUILD
std::ofstream _logFile;
#endif
std::uint32_t _indentLevel = 0;