[Fix] (Debug.cpp): FIx the format mistake of log file.

This commit is contained in:
BZLZHH
2025-04-04 11:27:43 +08:00
parent 64df4f634f
commit 9a61811db7
2 changed files with 4 additions and 6 deletions
+2 -4
View File
@@ -77,7 +77,7 @@ namespace MG_Util::Debug {
vprintf(full_format.c_str(), args); vprintf(full_format.c_str(), args);
va_list args_copy; va_list args_copy;
va_copy(args_copy, args); va_copy(args_copy, args);
LogWrite(full_format.c_str(), args); LogWrite(full_format.c_str(), args_copy);
va_end(args_copy); va_end(args_copy);
} }
@@ -120,12 +120,10 @@ void Log##name(const char* format, ...) { \
logFile = fopen(MG_Global::Common::LOG_FILE_PATH, "a"); logFile = fopen(MG_Global::Common::LOG_FILE_PATH, "a");
} }
void LogWrite(const char* format, ...) { void LogWrite(const char* format, va_list args) {
if (!MG_Global::Common::LOG_FILE_PATH || logFile == nullptr) if (!MG_Global::Common::LOG_FILE_PATH || logFile == nullptr)
return; return;
va_list args;
va_start(args, format);
vfprintf(logFile, format, args); vfprintf(logFile, format, args);
va_end(args); va_end(args);
fflush(logFile); fflush(logFile);
+1 -1
View File
@@ -20,7 +20,7 @@ namespace MG_Util {
void LogF (const char* format, ...); void LogF (const char* format, ...);
void LogClear(); void LogClear();
void LogInit(); void LogInit();
void LogWrite(const char* format, ...); void LogWrite(const char* format, va_list args);
const char* GLEnumToString(::GLenum value); const char* GLEnumToString(::GLenum value);
} }