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

@@ -6,7 +6,7 @@
#include <gui/gui.h>
#include <gui/icons.h>
#include <version.h>
#include <spdlog/spdlog.h>
#include <utils/flog.h>
#include <gui/widgets/bandplan.h>
#include <stb_image.h>
#include <config.h>
@@ -53,13 +53,13 @@ namespace core {
gui::mainWindow.setViewBandwidthSlider(1.0);
// Debug logs
spdlog::info("New DSP samplerate: {0} (source samplerate is {1})", effectiveSr, samplerate);
flog::info("New DSP samplerate: {0} (source samplerate is {1})", effectiveSr, samplerate);
}
};
// main
int sdrpp_main(int argc, char* argv[]) {
spdlog::info("SDR++ v" VERSION_STR);
flog::info("SDR++ v" VERSION_STR);
#ifdef IS_MACOS_BUNDLE
// If this is a MacOS .app, CD to the correct directory
@@ -90,16 +90,16 @@ int sdrpp_main(int argc, char* argv[]) {
// Check root directory
std::string root = (std::string)core::args["root"];
if (!std::filesystem::exists(root)) {
spdlog::warn("Root directory {0} does not exist, creating it", root);
flog::warn("Root directory {0} does not exist, creating it", root);
if (!std::filesystem::create_directories(root)) {
spdlog::error("Could not create root directory {0}", root);
flog::error("Could not create root directory {0}", root);
return -1;
}
}
// Check that the path actually is a directory
if (!std::filesystem::is_directory(root)) {
spdlog::error("{0} is not a directory", root);
flog::error("{0} is not a directory", root);
return -1;
}
@@ -257,7 +257,7 @@ int sdrpp_main(int argc, char* argv[]) {
#endif
// Load config
spdlog::info("Loading config");
flog::info("Loading config");
core::configManager.setPath(root + "/config.json");
core::configManager.load(defConfig);
core::configManager.enableAutoSave();
@@ -295,7 +295,7 @@ int sdrpp_main(int argc, char* argv[]) {
// Fix missing elements in config
for (auto const& item : defConfig.items()) {
if (!core::configManager.conf.contains(item.key())) {
spdlog::info("Missing key in config {0}, repairing", item.key());
flog::info("Missing key in config {0}, repairing", item.key());
core::configManager.conf[item.key()] = defConfig[item.key()];
}
}
@@ -304,7 +304,7 @@ int sdrpp_main(int argc, char* argv[]) {
auto items = core::configManager.conf.items();
for (auto const& item : items) {
if (!defConfig.contains(item.key())) {
spdlog::info("Unused key in config {0}, repairing", item.key());
flog::info("Unused key in config {0}, repairing", item.key());
core::configManager.conf.erase(item.key());
}
}
@@ -334,7 +334,7 @@ int sdrpp_main(int argc, char* argv[]) {
// Assert that the resource directory is absolute and check existence
resDir = std::filesystem::absolute(resDir).string();
if (!std::filesystem::is_directory(resDir)) {
spdlog::error("Resource directory doesn't exist! Please make sure that you've configured it correctly in config.json (check readme for details)");
flog::error("Resource directory doesn't exist! Please make sure that you've configured it correctly in config.json (check readme for details)");
return 1;
}
@@ -350,20 +350,20 @@ int sdrpp_main(int argc, char* argv[]) {
LoadingScreen::init();
LoadingScreen::show("Loading icons");
spdlog::info("Loading icons");
flog::info("Loading icons");
if (!icons::load(resDir)) { return -1; }
LoadingScreen::show("Loading band plans");
spdlog::info("Loading band plans");
flog::info("Loading band plans");
bandplan::loadFromDir(resDir + "/bandplans");
LoadingScreen::show("Loading band plan colors");
spdlog::info("Loading band plans color table");
flog::info("Loading band plans color table");
bandplan::loadColorTable(bandColors);
gui::mainWindow.init();
spdlog::info("Ready.");
flog::info("Ready.");
// Run render loop (TODO: CHECK RETURN VALUE)
backend::renderLoop();
@@ -384,6 +384,6 @@ int sdrpp_main(int argc, char* argv[]) {
core::configManager.save();
#endif
spdlog::info("Exiting successfully");
flog::info("Exiting successfully");
return 0;
}