From 9456f23fd5ed82f89ac7de5b6b8204c2d264f6da Mon Sep 17 00:00:00 2001 From: NAUD Maxence <maxence.naud@cea.fr> Date: Thu, 23 Jan 2025 17:30:08 +0000 Subject: [PATCH] fix NDEBUG precompilation condition in log --- include/aidge/utils/Log.hpp | 10 +++++----- src/utils/Log.cpp | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/aidge/utils/Log.hpp b/include/aidge/utils/Log.hpp index ca16018db..394d65906 100644 --- a/include/aidge/utils/Log.hpp +++ b/include/aidge/utils/Log.hpp @@ -108,15 +108,15 @@ public: * @param args Format string and arguments for the message * @note Debug messages are only compiled in debug builds */ -#ifdef NDEBUG +#ifndef NDEBUG template <typename... Args> - static void debug(Args&&... /*args*/) { - // Debug logging disabled in release builds + static void debug(Args&&... args) { + log(Debug, fmt::format(std::forward<Args>(args)...)); } #else template <typename... Args> - static void debug(Args&&... args) { - log(Debug, fmt::format(std::forward<Args>(args)...)); + static void debug(Args&&... /*args*/) { + // Debug logging disabled in release builds } #endif diff --git a/src/utils/Log.cpp b/src/utils/Log.cpp index b2aad14c9..45f03a7ae 100644 --- a/src/utils/Log.cpp +++ b/src/utils/Log.cpp @@ -26,7 +26,7 @@ namespace Aidge { * Log::Level::Notice. */ Log::Level Log::mConsoleLevel = []() { -#ifdef NDEBUG +#ifndef NDEBUG constexpr Level defaultLevel = Level::Debug; #else constexpr Log::Level defaultLevel = Level::Notice; @@ -57,7 +57,7 @@ bool Log::mConsoleColor = []() { * then the default level is Log::Level::Debug, else it is Log::Level::Notice. */ Log::Level Log::mFileLevel = []() { -#ifdef NDEBUG +#ifndef NDEBUG constexpr Level defaultLevel = Level::Debug; #else constexpr Log::Level defaultLevel = Level::Notice; -- GitLab