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

@ -47,10 +47,10 @@ namespace backend {
void handleAppCmd(struct android_app* app, int32_t appCmd) {
switch (appCmd) {
case APP_CMD_SAVE_STATE:
spdlog::warn("APP_CMD_SAVE_STATE");
flog::warn("APP_CMD_SAVE_STATE");
break;
case APP_CMD_INIT_WINDOW:
spdlog::warn("APP_CMD_INIT_WINDOW");
flog::warn("APP_CMD_INIT_WINDOW");
if (pauseRendering && !exited) {
doPartialInit();
pauseRendering = false;
@ -58,15 +58,15 @@ namespace backend {
exited = false;
break;
case APP_CMD_TERM_WINDOW:
spdlog::warn("APP_CMD_TERM_WINDOW");
flog::warn("APP_CMD_TERM_WINDOW");
pauseRendering = true;
backend::end();
break;
case APP_CMD_GAINED_FOCUS:
spdlog::warn("APP_CMD_GAINED_FOCUS");
flog::warn("APP_CMD_GAINED_FOCUS");
break;
case APP_CMD_LOST_FOCUS:
spdlog::warn("APP_CMD_LOST_FOCUS");
flog::warn("APP_CMD_LOST_FOCUS");
break;
}
}
@ -77,7 +77,7 @@ namespace backend {
int aquireWindow() {
while (!app->window) {
spdlog::warn("Waiting on the shitty window thing"); std::this_thread::sleep_for(std::chrono::milliseconds(30));
flog::warn("Waiting on the shitty window thing"); std::this_thread::sleep_for(std::chrono::milliseconds(30));
int out_events;
struct android_poll_source* out_data;
@ -96,7 +96,7 @@ namespace backend {
}
int init(std::string resDir) {
spdlog::warn("Backend init");
flog::warn("Backend init");
// Get window
aquireWindow();
@ -174,7 +174,7 @@ namespace backend {
void setMouseScreenPos(double x, double y) {}
int renderLoop() {
spdlog::warn("BRUH: {0}", (void*)backend::app->window);
flog::warn("BRUH: {0}", (void*)backend::app->window);
while (true) {
int out_events;
struct android_poll_source* out_data;
@ -185,7 +185,7 @@ namespace backend {
// Exit the app by returning from within the infinite loop
if (app->destroyRequested != 0) {
spdlog::warn("ASKED TO EXIT");
flog::warn("ASKED TO EXIT");
exited = true;
// Stop SDR
@ -465,7 +465,7 @@ extern "C" {
// Check if this is the first time we run or not
if (backend::initialized) {
spdlog::warn("android_main called again");
flog::warn("android_main called again");
backend::doPartialInit();
backend::pauseRendering = false;
backend::renderLoop();
@ -474,9 +474,9 @@ extern "C" {
backend::initialized = true;
// prepare spdlog
auto console_sink = std::make_shared<spdlog::sinks::android_sink_st>("SDR++");
auto logger = std::shared_ptr<spdlog::logger>(new spdlog::logger("", { console_sink }));
spdlog::set_default_logger(logger);
auto console_sink = std::make_shared<flog::sinks::android_sink_st>("SDR++");
auto logger = std::shared_ptr<flog::logger>(new flog::logger("", { console_sink }));
flog::set_default_logger(logger);
// Grab files dir
std::string appdir = backend::getAppFilesDir();

View File

@ -3,7 +3,7 @@
#include "imgui_impl_glfw.h"
#include "imgui_impl_opengl3.h"
#include <GLFW/glfw3.h>
#include <spdlog/spdlog.h>
#include <utils/flog.h>
#include <utils/opengl_include_code.h>
#include <version.h>
#include <core.h>
@ -50,7 +50,7 @@ namespace backend {
GLFWmonitor* monitor;
static void glfw_error_callback(int error, const char* description) {
spdlog::error("Glfw Error {0}: {1}", error, description);
flog::error("Glfw Error {0}: {1}", error, description);
}
static void maximized_callback(GLFWwindow* window, int n) {
@ -104,10 +104,10 @@ namespace backend {
monitor = glfwGetPrimaryMonitor();
window = glfwCreateWindow(winWidth, winHeight, "SDR++ v" VERSION_STR " (Built at " __TIME__ ", " __DATE__ ")", NULL, NULL);
if (window == NULL) {
spdlog::info("OpenGL {0}.{1} {2}was not supported", OPENGL_VERSIONS_MAJOR[i], OPENGL_VERSIONS_MINOR[i], OPENGL_VERSIONS_IS_ES[i] ? "ES " : "");
flog::info("OpenGL {0}.{1} {2}was not supported", OPENGL_VERSIONS_MAJOR[i], OPENGL_VERSIONS_MINOR[i], OPENGL_VERSIONS_IS_ES[i] ? "ES " : "");
continue;
}
spdlog::info("Using OpenGL {0}.{1}{2}", OPENGL_VERSIONS_MAJOR[i], OPENGL_VERSIONS_MINOR[i], OPENGL_VERSIONS_IS_ES[i] ? " ES" : "");
flog::info("Using OpenGL {0}.{1}{2}", OPENGL_VERSIONS_MAJOR[i], OPENGL_VERSIONS_MINOR[i], OPENGL_VERSIONS_IS_ES[i] ? " ES" : "");
glfwMakeContextCurrent(window);
break;
}
@ -116,7 +116,7 @@ namespace backend {
// Load app icon
if (!std::filesystem::is_regular_file(resDir + "/icons/sdrpp.png")) {
spdlog::error("Icon file '{0}' doesn't exist!", resDir + "/icons/sdrpp.png");
flog::error("Icon file '{0}' doesn't exist!", resDir + "/icons/sdrpp.png");
return 1;
}
@ -176,9 +176,9 @@ namespace backend {
if (!ImGui_ImplOpenGL3_Init(glsl_version)) {
// If init fail, try to fall back on GLSL 1.2
spdlog::warn("Could not init using OpenGL with normal GLSL version, falling back to GLSL 1.2");
flog::warn("Could not init using OpenGL with normal GLSL version, falling back to GLSL 1.2");
if (!ImGui_ImplOpenGL3_Init("#version 120")) {
spdlog::error("Failed to initialize OpenGL with GLSL 1.2");
flog::error("Failed to initialize OpenGL with GLSL 1.2");
return -1;
}
}
@ -186,7 +186,7 @@ namespace backend {
// Set window size and fullscreen state
glfwGetWindowSize(window, &_winWidth, &_winHeight);
if (fullScreen) {
spdlog::info("Fullscreen: ON");
flog::info("Fullscreen: ON");
fsWidth = _winWidth;
fsHeight = _winHeight;
glfwGetWindowPos(window, &fsPosX, &fsPosY);
@ -251,7 +251,7 @@ namespace backend {
if (ImGui::IsKeyPressed(GLFW_KEY_F11)) {
fullScreen = !fullScreen;
if (fullScreen) {
spdlog::info("Fullscreen: ON");
flog::info("Fullscreen: ON");
fsWidth = _winWidth;
fsHeight = _winHeight;
glfwGetWindowPos(window, &fsPosX, &fsPosY);
@ -262,7 +262,7 @@ namespace backend {
core::configManager.release();
}
else {
spdlog::info("Fullscreen: OFF");
flog::info("Fullscreen: OFF");
glfwSetWindowMonitor(window, nullptr, fsPosX, fsPosY, fsWidth, fsHeight, 0);
core::configManager.acquire();
core::configManager.conf["fullscreen"] = false;