Skip to content

Commit

Permalink
Log all Sys_Printf's when using -condebug
Browse files Browse the repository at this point in the history
  • Loading branch information
andrei-drexler committed Nov 12, 2023
1 parent 4976aec commit ebfdbbf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
11 changes: 4 additions & 7 deletions Quake/console.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ double con_times[NUM_CON_TIMES]; // realtime time the line was generated

int con_vislines;

qboolean con_debuglog = false;

qboolean con_initialized;


Expand Down Expand Up @@ -716,6 +714,10 @@ static int log_fd = -1; // log file descriptor
/*
================
Con_DebugLog
Writes msg to log if -condebug was specified on the command line
Note: msg is expected to be in UTF-8, not Quake charset
================
*/
void Con_DebugLog(const char *msg)
Expand Down Expand Up @@ -748,10 +750,6 @@ void Con_Printf (const char *fmt, ...)
// also echo to debugging console
Sys_Printf ("%s", msg);

// log all messages to file
if (con_debuglog)
Con_DebugLog(msg);

if (!con_initialized)
return;

Expand Down Expand Up @@ -1800,7 +1798,6 @@ void LOG_Init (quakeparms_t *parms)
return;
}

con_debuglog = true;
Con_DebugLog (va("LOG started on: %s \n", session));

}
Expand Down
3 changes: 3 additions & 0 deletions Quake/sys_sdl_unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,9 @@ void Sys_Printf (const char *fmt, ...)

UTF8_FromQuake (u8text, sizeof (u8text), qtext);
printf ("%s", u8text);

// log all messages to file as well if -condebug was specified
Con_DebugLog (u8text);
}

void Sys_Quit (void)
Expand Down
4 changes: 4 additions & 0 deletions Quake/sys_sdl_win.c
Original file line number Diff line number Diff line change
Expand Up @@ -912,6 +912,10 @@ void Sys_Printf (const char *fmt, ...)
va_end (argptr);

UTF8_FromQuake (u8text, sizeof (u8text), qtext);

// log all messages to file as well if -condebug was specified
Con_DebugLog (u8text);

len = MultiByteToWideChar (CP_UTF8, 0, u8text, -1, wtext, countof (wtext));
if (!len)
return;
Expand Down

0 comments on commit ebfdbbf

Please sign in to comment.