[Feat] (Debug): Add log target control with bitmask flags.

This commit is contained in:
BZLZHH
2025-06-20 13:22:57 +08:00
parent 47cd496e6d
commit 5c0b675ca8
3 changed files with 36 additions and 20 deletions
+14 -6
View File
@@ -71,14 +71,22 @@ namespace MG_Util::Debug {
std::string full_format = header + format + "\n";
#ifdef __ANDROID__
__android_log_vprint(androidLevel, MG_Constants::RenderName, full_format.c_str(), args);
if (MG_Global::Common::LogTarget & MG_Constants::Common::LOG_TARGET_ANDROID) {
__android_log_vprint(androidLevel, MG_Constants::RenderName, full_format.c_str(), args);
}
#endif
vprintf(full_format.c_str(), args);
va_list args_copy;
va_copy(args_copy, args);
LogWrite(full_format.c_str(), args_copy);
va_end(args_copy);
if (MG_Global::Common::LogTarget & MG_Constants::Common::LOG_TARGET_CONSOLE) {
vprintf(full_format.c_str(), args);
}
if ((MG_Global::Common::LogTarget & MG_Constants::Common::LOG_TARGET_FILE) &&
MG_Global::Common::LOG_FILE_PATH != nullptr) {
va_list args_copy;
va_copy(args_copy, args);
LogWrite(full_format.c_str(), args_copy);
va_end(args_copy);
}
}
#define DECLARE_LOG_FUNCTION(name, level) \