A lot of updates

This commit is contained in:
WolverinDEV
2019-11-22 20:50:58 +01:00
parent 2cae73c51a
commit 4d64f60f18
4 changed files with 208 additions and 114 deletions
+11 -2
View File
@@ -3,6 +3,7 @@
#include <iomanip>
#include <fstream>
#include <map>
#include <CXXTerminal/Terminal.h>
#include <spdlog/spdlog.h>
#include <experimental/filesystem>
#include <StringVariable.h>
@@ -66,8 +67,15 @@ namespace logger {
if(!logFile.parent_path().empty())
fs::create_directories(logFile.parent_path());
auto fileSink = make_shared<ColoredFileSink>(logFile.string(), 1024 * 1024 * 50, 12);
sinks.push_back(fileSink);
try {
auto fileSink = make_shared<ColoredFileSink>(logFile.string(), 1024 * 1024 * 50, 12);
sinks.push_back(fileSink);
} catch(std::exception& ex) {
if(group != 0 && group != -1)
logger(0)->critical("Failed to create file for new log group: {}", ex.what());
else
terminal::instance()->writeMessage("§4[CRITICAL] §eFailed to create main log file: " + string{ex.what()}, false);
}
} else {
path = "/dev/null (" + to_string(serverId) + ")";
}
@@ -140,6 +148,7 @@ namespace logger {
loggerEntry.second.reset();
}
loggers.clear();
spdlog::drop_all();
logConfig = nullptr;
terminalSink = nullptr;