[Optimize] (MG_Util/Debug): avoid runtime cost of unneeded log function (forced at compile time)

This commit is contained in:
2025-06-27 22:29:24 +08:00
parent a5a661261d
commit 0207ee85b7
+10 -8
View File
@@ -92,14 +92,16 @@ namespace MG_Util::Debug {
#define DECLARE_LOG_FUNCTION(name, level) \ #define DECLARE_LOG_FUNCTION(name, level) \
void Log##name(const char* format, ...) { \ void Log##name(const char* format, ...) { \
va_list args; \ if constexpr (MG_Global::Common::LogLevel <= MG_Constants::Common::LOG_LEVEL_##level) { \
va_start(args, format); \ va_list args; \
LogImpl(MG_Constants::Common::LOG_LEVEL_##level, \ va_start(args, format); \
#level, \ LogImpl(MG_Constants::Common::LOG_LEVEL_##level, \
format, \ #level, \
ANDROID_LOG_##level, \ format, \
args); \ ANDROID_LOG_##level, \
va_end(args); \ args); \
va_end(args); \
} \
} }
DECLARE_LOG_FUNCTION(D, DEBUG) DECLARE_LOG_FUNCTION(D, DEBUG)