From 1572b8acab75df6117ab944f8ee8ab1f68500852 Mon Sep 17 00:00:00 2001 From: Shauren Date: Mon, 26 Feb 2024 22:55:27 +0100 Subject: Core/Logging: Call Log::instance() only once in each log statement --- src/common/Logging/Log.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/common/Logging/Log.h') diff --git a/src/common/Logging/Log.h b/src/common/Logging/Log.h index 1e413ece0bb..d6e329a71dd 100644 --- a/src/common/Logging/Log.h +++ b/src/common/Logging/Log.h @@ -134,19 +134,19 @@ class TC_COMMON_API Log #elif TRINITY_PLATFORM != TRINITY_PLATFORM_WINDOWS // This will catch format errors on build time -#define TC_LOG_MESSAGE_BODY(filterType__, level__, ...) \ - do { \ - if (sLog->ShouldLog(filterType__, level__)) \ - sLog->OutMessage(filterType__, level__, __VA_ARGS__); \ +#define TC_LOG_MESSAGE_BODY(filterType__, level__, ...) \ + do { \ + if (Log* logInstance = sLog; logInstance->ShouldLog(filterType__, level__)) \ + logInstance->OutMessage(filterType__, level__, __VA_ARGS__); \ } while (0) #else -#define TC_LOG_MESSAGE_BODY(filterType__, level__, ...) \ - __pragma(warning(push)) \ - __pragma(warning(disable:4127)) \ - do { \ - if (sLog->ShouldLog(filterType__, level__)) \ - sLog->OutMessage(filterType__, level__, __VA_ARGS__); \ - } while (0) \ +#define TC_LOG_MESSAGE_BODY(filterType__, level__, ...) \ + __pragma(warning(push)) \ + __pragma(warning(disable:4127)) \ + do { \ + if (Log* logInstance = sLog; logInstance->ShouldLog(filterType__, level__)) \ + logInstance->OutMessage(filterType__, level__, __VA_ARGS__); \ + } while (0) \ __pragma(warning(pop)) #endif -- cgit v1.2.3