mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-07-09 10:35:21 +02:00
Switched to a custom logging lib instead of that spdlog junk
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
#include "server.h"
|
||||
#include "core.h"
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <utils/flog.h>
|
||||
#include <version.h>
|
||||
#include <config.h>
|
||||
#include <filesystem>
|
||||
@ -47,7 +47,7 @@ namespace server {
|
||||
double sampleRate = 1000000.0;
|
||||
|
||||
int main() {
|
||||
spdlog::info("=====| SERVER MODE |=====");
|
||||
flog::info("=====| SERVER MODE |=====");
|
||||
|
||||
// Init DSP
|
||||
comp.init(&dummyInput, dsp::compression::PCM_TYPE_I8);
|
||||
@ -87,7 +87,7 @@ namespace server {
|
||||
// Initialize SmGui in server mode
|
||||
SmGui::init(true);
|
||||
|
||||
spdlog::info("Loading modules");
|
||||
flog::info("Loading modules");
|
||||
// Load modules and check type to only load sources ( TODO: Have a proper type parameter int the info )
|
||||
// TODO LATER: Add whitelist/blacklist stuff
|
||||
if (std::filesystem::is_directory(modulesDir)) {
|
||||
@ -100,12 +100,12 @@ namespace server {
|
||||
if (!file.is_regular_file()) { continue; }
|
||||
if (fn.find("source") == std::string::npos) { continue; }
|
||||
|
||||
spdlog::info("Loading {0}", path);
|
||||
flog::info("Loading {0}", path);
|
||||
core::moduleManager.loadModule(path);
|
||||
}
|
||||
}
|
||||
else {
|
||||
spdlog::warn("Module directory {0} does not exist, not loading modules from directory", modulesDir);
|
||||
flog::warn("Module directory {0} does not exist, not loading modules from directory", modulesDir);
|
||||
}
|
||||
|
||||
// Load additional modules through the config ( TODO: Have a proper type parameter int the info )
|
||||
@ -120,7 +120,7 @@ namespace server {
|
||||
if (!std::filesystem::is_regular_file(file)) { continue; }
|
||||
if (fn.find("source") == std::string::npos) { continue; }
|
||||
|
||||
spdlog::info("Loading {0}", path);
|
||||
flog::info("Loading {0}", path);
|
||||
core::moduleManager.loadModule(path);
|
||||
}
|
||||
|
||||
@ -129,7 +129,7 @@ namespace server {
|
||||
std::string mod = _module["module"];
|
||||
bool enabled = _module["enabled"];
|
||||
if (core::moduleManager.modules.find(mod) == core::moduleManager.modules.end()) { continue; }
|
||||
spdlog::info("Initializing {0} ({1})", name, mod);
|
||||
flog::info("Initializing {0} ({1})", name, mod);
|
||||
core::moduleManager.createInstance(name, mod);
|
||||
if (!enabled) { core::moduleManager.disableInstance(name); }
|
||||
}
|
||||
@ -154,7 +154,7 @@ namespace server {
|
||||
listener = net::listen(host, port);
|
||||
listener->acceptAsync(_clientHandler, NULL);
|
||||
|
||||
spdlog::info("Ready, listening on {0}:{1}", host, port);
|
||||
flog::info("Ready, listening on {0}:{1}", host, port);
|
||||
while(1) { std::this_thread::sleep_for(std::chrono::milliseconds(100)); }
|
||||
|
||||
return 0;
|
||||
@ -163,7 +163,7 @@ namespace server {
|
||||
void _clientHandler(net::Conn conn, void* ctx) {
|
||||
// Reject if someone else is already connected
|
||||
if (client && client->isOpen()) {
|
||||
spdlog::info("REJECTED Connection from {0}:{1}, another client is already connected.", "TODO", "TODO");
|
||||
flog::info("REJECTED Connection from {0}:{1}, another client is already connected.", "TODO", "TODO");
|
||||
|
||||
// Issue a disconnect command to the client
|
||||
uint8_t buf[sizeof(PacketHeader) + sizeof(CommandHeader)];
|
||||
@ -184,7 +184,7 @@ namespace server {
|
||||
return;
|
||||
}
|
||||
|
||||
spdlog::info("Connection from {0}:{1}", "TODO", "TODO");
|
||||
flog::info("Connection from {0}:{1}", "TODO", "TODO");
|
||||
client = std::move(conn);
|
||||
client->readAsync(sizeof(PacketHeader), rbuf, _packetHandler, NULL);
|
||||
|
||||
@ -299,7 +299,7 @@ namespace server {
|
||||
compression = *(uint8_t*)data;
|
||||
}
|
||||
else {
|
||||
spdlog::error("Invalid Command: {0} (len = {1})", cmd, len);
|
||||
flog::error("Invalid Command: {0} (len = {1})", (int)cmd, len);
|
||||
sendError(ERROR_INVALID_COMMAND);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user