Logger: go back to outputting to the console.
Considering I went back to Windows, this is gonna be better than outputting to a file.
This commit is contained in:
parent
389dabfc77
commit
938bf7b8b5
2 changed files with 15 additions and 3 deletions
|
@ -16,10 +16,12 @@
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
#ifndef SAVETOOL_DEBUG_BUILD
|
||||||
#include <Corrade/Containers/Optional.h>
|
#include <Corrade/Containers/Optional.h>
|
||||||
#include <Corrade/Containers/Pair.h>
|
#include <Corrade/Containers/Pair.h>
|
||||||
#include <Corrade/Utility/Debug.h>
|
|
||||||
#include <Corrade/Utility/Path.h>
|
#include <Corrade/Utility/Path.h>
|
||||||
|
#endif
|
||||||
|
#include <Corrade/Utility/Debug.h>
|
||||||
|
|
||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
|
|
||||||
|
@ -36,9 +38,9 @@ Logger::instance() {
|
||||||
|
|
||||||
void
|
void
|
||||||
Logger::initialise() {
|
Logger::initialise() {
|
||||||
|
#ifndef SAVETOOL_DEBUG_BUILD
|
||||||
auto exe_path = Utility::Path::split(*Utility::Path::executableLocation()).first();
|
auto exe_path = Utility::Path::split(*Utility::Path::executableLocation()).first();
|
||||||
_logFile.open(Utility::Path::join(exe_path, "SaveToolLog.txt").cbegin(), std::ios::trunc);
|
_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" <<
|
_logFile << "In case you encounter a bug:\n" <<
|
||||||
"1. Do not run the Save Tool again, as this log will be cleared.\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" <<
|
"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
|
void
|
||||||
Logger::log(EntryType type, StringView location, StringView message) {
|
Logger::log(EntryType type, StringView location, StringView message) {
|
||||||
Debug d{&_logFile};
|
Debug d{
|
||||||
|
#ifdef SAVETOOL_DEBUG_BUILD
|
||||||
|
&std::cout
|
||||||
|
#else
|
||||||
|
&_logFile
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case EntryType::Info:
|
case EntryType::Info:
|
||||||
|
|
|
@ -18,7 +18,9 @@
|
||||||
|
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
|
||||||
|
#ifndef SAVETOOL_DEBUG_BUILD
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#endif
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
#include <Corrade/Containers/String.h>
|
#include <Corrade/Containers/String.h>
|
||||||
|
@ -58,7 +60,9 @@ class Logger {
|
||||||
private:
|
private:
|
||||||
Logger() = default;
|
Logger() = default;
|
||||||
|
|
||||||
|
#ifndef SAVETOOL_DEBUG_BUILD
|
||||||
std::ofstream _logFile;
|
std::ofstream _logFile;
|
||||||
|
#endif
|
||||||
|
|
||||||
std::uint32_t _indentLevel = 0;
|
std::uint32_t _indentLevel = 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue