mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-12 06:08:30 +09:00
[Optimize] (MG_Util/Debug): avoid runtime cost of unneeded log function (forced at compile time)
This commit is contained in:
@@ -92,6 +92,7 @@ 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, ...) { \
|
||||||
|
if constexpr (MG_Global::Common::LogLevel <= MG_Constants::Common::LOG_LEVEL_##level) { \
|
||||||
va_list args; \
|
va_list args; \
|
||||||
va_start(args, format); \
|
va_start(args, format); \
|
||||||
LogImpl(MG_Constants::Common::LOG_LEVEL_##level, \
|
LogImpl(MG_Constants::Common::LOG_LEVEL_##level, \
|
||||||
@@ -100,6 +101,7 @@ void Log##name(const char* format, ...) { \
|
|||||||
ANDROID_LOG_##level, \
|
ANDROID_LOG_##level, \
|
||||||
args); \
|
args); \
|
||||||
va_end(args); \
|
va_end(args); \
|
||||||
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
DECLARE_LOG_FUNCTION(D, DEBUG)
|
DECLARE_LOG_FUNCTION(D, DEBUG)
|
||||||
|
|||||||
Reference in New Issue
Block a user