Switched to a custom logging lib instead of that spdlog junk

This commit is contained in:
AlexandreRouma
2023-02-25 18:12:34 +01:00
parent 7e80bbd02c
commit 7723d15e8f
154 changed files with 723 additions and 19918 deletions

View File

@ -1,5 +1,5 @@
#include <config.h>
#include <spdlog/spdlog.h>
#include <utils/flog.h>
#include <fstream>
#include <filesystem>
@ -18,16 +18,16 @@ void ConfigManager::setPath(std::string file) {
void ConfigManager::load(json def, bool lock) {
if (lock) { mtx.lock(); }
if (path == "") {
spdlog::error("Config manager tried to load file with no path specified");
flog::error("Config manager tried to load file with no path specified");
return;
}
if (!std::filesystem::exists(path)) {
spdlog::warn("Config file '{0}' does not exist, creating it", path);
flog::warn("Config file '{0}' does not exist, creating it", path);
conf = def;
save(false);
}
if (!std::filesystem::is_regular_file(path)) {
spdlog::error("Config file '{0}' isn't a file", path);
flog::error("Config file '{0}' isn't a file", path);
return;
}
@ -37,7 +37,7 @@ void ConfigManager::load(json def, bool lock) {
file.close();
}
catch (std::exception e) {
spdlog::error("Config file '{0}' is corrupted, resetting it", path);
flog::error("Config file '{0}' is corrupted, resetting it", path);
conf = def;
save(false);
}
@ -82,7 +82,7 @@ void ConfigManager::release(bool modified) {
void ConfigManager::autoSaveWorker() {
while (autoSaveEnabled) {
if (!mtx.try_lock()) {
spdlog::warn("ConfigManager locked, waiting...");
flog::warn("ConfigManager locked, waiting...");
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
continue;
}