Correct the position of a mutex lock in logging

This commit is contained in:
Henrik Rydgård committed 2025-06-06 19:36:43 +02:00
1 parent ed127188a0
commit a4b2a6051c
1 file changed
+2 -1
+2 -1
View File
@@ -418,7 +418,6 @@ void LogManager::StdioLog(const LogMessage &message) {
__android_log_print(mode, LOG_APP_NAME, "%.*s", (int)msg.size(), msg.data());
}
#else
std::lock_guard<std::mutex> lock(stdioLock_);
char text[2048];
snprintf(text, sizeof(text), "%s %s %s", message.timestamp, message.header, message.msg.c_str());
text[sizeof(text) - 2] = '\n';
@@ -449,6 +448,8 @@ void LogManager::StdioLog(const LogMessage &message) {
break;
}
}
std::lock_guard<std::mutex> lock(stdioLock_);
fprintf(stderr, "%s%s%s", colorAttr, text, resetAttr);
#endif
}