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 <imgui.h>
#include <spdlog/spdlog.h>
#include <utils/flog.h>
#include <module.h>
#include <gui/gui.h>
#include <gui/style.h>

View File

@ -1,5 +1,5 @@
#include <imgui.h>
#include <spdlog/spdlog.h>
#include <utils/flog.h>
#include <module.h>
#include <gui/gui.h>
#include <gui/style.h>
@ -758,19 +758,19 @@ private:
fs >> importBookmarks;
if (!importBookmarks.contains("bookmarks")) {
spdlog::error("File does not contains any bookmarks");
flog::error("File does not contains any bookmarks");
return;
}
if (!importBookmarks["bookmarks"].is_object()) {
spdlog::error("Bookmark attribute is invalid");
flog::error("Bookmark attribute is invalid");
return;
}
// Load every bookmark
for (auto const [_name, bm] : importBookmarks["bookmarks"].items()) {
if (bookmarks.find(_name) != bookmarks.end()) {
spdlog::warn("Bookmark with the name '{0}' already exists in list, skipping", _name);
flog::warn("Bookmark with the name '{0}' already exists in list, skipping", _name);
continue;
}
FrequencyBookmark fbm;

View File

@ -171,7 +171,7 @@ public:
std::string extension = ".wav";
std::string expandedPath = expandString(folderSelect.path + "/" + genFileName(nameTemplate, type, vfoName) + extension);
if (!writer.open(expandedPath)) {
spdlog::error("Failed to open file for recording: {0}", expandedPath);
flog::error("Failed to open file for recording: {0}", expandedPath);
return;
}
@ -557,9 +557,9 @@ MOD_EXPORT void _INIT_() {
// Create default recording directory
std::string root = (std::string)core::args["root"];
if (!std::filesystem::exists(root + "/recordings")) {
spdlog::warn("Recordings directory does not exist, creating it");
flog::warn("Recordings directory does not exist, creating it");
if (!std::filesystem::create_directory(root + "/recordings")) {
spdlog::error("Could not create recordings directory");
flog::error("Could not create recordings directory");
}
}
json def = json({});

View File

@ -81,7 +81,7 @@ public:
client = net::rigctl::connect(host, port);
}
catch (std::exception e) {
spdlog::error("Could not connect: {0}", e.what());
flog::error("Could not connect: {0}", e.what());
return;
}
@ -163,7 +163,7 @@ private:
RigctlClientModule* _this = (RigctlClientModule*)ctx;
if (!_this->client || !_this->client->isOpen()) { return; }
if (_this->client->setFreq(freq)) {
spdlog::error("Could not set frequency");
flog::error("Could not set frequency");
}
}

View File

@ -201,7 +201,7 @@ private:
listener->acceptAsync(clientHandler, this);
}
catch (std::exception e) {
spdlog::error("Could not start rigctl server: {0}", e.what());
flog::error("Could not start rigctl server: {0}", e.what());
}
}
@ -306,14 +306,14 @@ private:
static void clientHandler(net::Conn _client, void* ctx) {
SigctlServerModule* _this = (SigctlServerModule*)ctx;
//spdlog::info("New client!");
//flog::info("New client!");
_this->client = std::move(_client);
_this->client->readAsync(1024, _this->dataBuf, dataHandler, _this, false);
_this->client->waitForEnd();
_this->client->close();
//spdlog::info("Client disconnected!");
//flog::info("Client disconnected!");
_this->listener->acceptAsync(clientHandler, _this);
}
@ -371,7 +371,7 @@ private:
return;
}
spdlog::info("Rigctl command: '{0}'", cmd);
flog::info("Rigctl command: '{0}'", cmd);
// Otherwise, execute the command
if (parts[0] == "F" || parts[0] == "\\set_freq") {
@ -692,7 +692,7 @@ private:
}
else {
// If command is not recognized, return error
spdlog::error("Rigctl client sent invalid command: '{0}'", cmd);
flog::error("Rigctl client sent invalid command: '{0}'", cmd);
resp = "RPRT 1\n";
client->write(resp.size(), (uint8_t*)resp.c_str());
return;

View File

@ -152,7 +152,7 @@ private:
// Check if we are waiting for a tune
if (tuning) {
spdlog::warn("Tuning");
flog::warn("Tuning");
if ((std::chrono::duration_cast<std::chrono::milliseconds>(now - lastTuneTime)).count() > tuningTime) {
tuning = false;
}
@ -174,7 +174,7 @@ private:
double vfoWidth = sigpath::vfoManager.getBandwidth(gui::waterfall.selectedVFO);
if (receiving) {
spdlog::warn("Receiving");
flog::warn("Receiving");
float maxLevel = getMaxLevel(data, current, vfoWidth, dataWidth, wfStart, wfWidth);
if (maxLevel >= level) {
@ -185,7 +185,7 @@ private:
}
}
else {
spdlog::warn("Seeking signal");
flog::warn("Seeking signal");
double bottomLimit = current;
double topLimit = current;

View File

@ -1,7 +1,7 @@
#pragma once
#include <json.hpp>
#include <memory>
#include <spdlog/spdlog.h>
#include <utils/flog.h>
using namespace nlohmann;