Fix timestamps printed twice on the same line (#714)

This commit is contained in:
smallmodel 2025-04-19 21:35:53 +02:00 committed by GitHub
parent aa54e3c673
commit 42326ec708
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -304,6 +304,7 @@ void QDECL Com_Printf( const char *fmt, ... ) {
//================ //================
size_t msgLen = strlen(msg); size_t msgLen = strlen(msg);
if (msgLen > 0) {
if (com_logfile_timestamps->integer) { if (com_logfile_timestamps->integer) {
static qboolean no_newline = qfalse; static qboolean no_newline = qfalse;
@ -342,7 +343,7 @@ void QDECL Com_Printf( const char *fmt, ... ) {
FS_Write("] ", 2, logfile); FS_Write("] ", 2, logfile);
} }
if (msgLen > 1 && msg[msgLen - 1] != '\n') { if (msg[msgLen - 1] != '\n') {
// Don't write the time if the previous message has no newline // Don't write the time if the previous message has no newline
no_newline = qtrue; no_newline = qtrue;
} else { } else {
@ -354,6 +355,7 @@ void QDECL Com_Printf( const char *fmt, ... ) {
FS_Write(msg, msgLen, logfile); FS_Write(msg, msgLen, logfile);
} }
} }
}
recursive_count--; recursive_count--;
} }