diff options
author | Shauren <shauren.trinity@gmail.com> | 2024-02-26 22:55:27 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2024-02-26 22:55:27 +0100 |
commit | 1572b8acab75df6117ab944f8ee8ab1f68500852 (patch) | |
tree | ba5c491417078b010c899deb6fd7c604be77fa22 | |
parent | 409adfa7a5372dedd40d6f40650c901f6fd646a6 (diff) |
Core/Logging: Call Log::instance() only once in each log statement
-rw-r--r-- | src/common/Logging/Log.h | 22 |
1 files changed, 11 insertions, 11 deletions
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 |