aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2024-02-26 22:55:27 +0100
committerShauren <shauren.trinity@gmail.com>2024-02-26 22:55:27 +0100
commit1572b8acab75df6117ab944f8ee8ab1f68500852 (patch)
treeba5c491417078b010c899deb6fd7c604be77fa22
parent409adfa7a5372dedd40d6f40650c901f6fd646a6 (diff)
Core/Logging: Call Log::instance() only once in each log statement
-rw-r--r--src/common/Logging/Log.h22
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