From d06f4049fa11e1585ab2949de745e91b604a0b15 Mon Sep 17 00:00:00 2001 From: Maschell Date: Wed, 19 Feb 2025 12:23:10 +0100 Subject: [PATCH] Imrovde/fix logging --- source/logger.h | 4 ++++ source/main.cpp | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/source/logger.h b/source/logger.h index e49c2b6..5c13e80 100644 --- a/source/logger.h +++ b/source/logger.h @@ -37,6 +37,8 @@ extern "C" { #define DEBUG_FUNCTION_LINE_WRITE(FMT, ARGS...) LOG(WHBLogWritef, FMT, ##ARGS) +#define DEBUG_FUNCTION_LINE_WARN(FMT, ARGS...) LOG_EX_DEFAULT(WHBLogPrintf, "##WARN ## ", "", FMT, ##ARGS) + #define DEBUG_FUNCTION_LINE_ERR(FMT, ARGS...) LOG_EX_DEFAULT(WHBLogPrintf, "##ERROR## ", "", FMT, ##ARGS) #define DEBUG_FUNCTION_LINE_ERR_LAMBDA(FILENAME, FUNCTION, LINE, FMT, ARGS...) LOG_EX(FILENAME, FUNCTION, LINE, WHBLogPrintf, "##ERROR## ", "", FMT, ##ARGS); @@ -51,6 +53,8 @@ extern "C" { #define DEBUG_FUNCTION_LINE_WRITE(FMT, ARGS...) while (0) +#define DEBUG_FUNCTION_LINE_WARN(FMT, ARGS...) LOG_EX_DEFAULT(OSReport, "##WARN ## ", "\n", FMT, ##ARGS) + #define DEBUG_FUNCTION_LINE_ERR(FMT, ARGS...) LOG_EX_DEFAULT(OSReport, "##ERROR## ", "\n", FMT, ##ARGS) #define DEBUG_FUNCTION_LINE_ERR_LAMBDA(FILENAME, FUNCTION, LINE, FMT, ARGS...) LOG_EX(FILENAME, FUNCTION, LINE, OSReport, "##ERROR## ", "\n", FMT, ##ARGS); diff --git a/source/main.cpp b/source/main.cpp index 76eb077..9079688 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -31,7 +31,7 @@ WUMS_INTERNAL_HOOK_CLEAR_ALLOCATED_RPL_MEMORY() { // If an allocated rpl was not released properly (e.g. if something else calls OSDynload_Acquire without releasing it) // memory gets leaked. Let's clean this up! for (auto &addr : gAllocatedAddresses) { - DEBUG_FUNCTION_LINE_ERR("Memory allocated by OSDynload was not freed properly, let's clean it up! (%08X)", addr); + DEBUG_FUNCTION_LINE_WARN("Memory allocated by OSDynload was not freed properly, let's clean it up! (%08X)", addr); free((void *) addr); } gAllocatedAddresses.clear(); @@ -75,7 +75,6 @@ static void CustomDynLoadFree(void *addr) { } WUMS_INTERNAL_GET_CUSTOM_RPL_ALLOCATOR() { - DEBUG_FUNCTION_LINE_ERR("WUMS_INTERNAL_GET_CUSTOM_RPL_ALLOCATOR"); return {CustomDynLoadAlloc, CustomDynLoadFree}; }