*/
cvar_t log_file = {0, "log_file",""};
-cvar_t log_sync = {0, "log_sync","0"};
char crt_log_file [MAX_OSPATH] = "";
qfile_t* logfile = NULL;
logq_ind = 0;
Cvar_RegisterVariable (&log_file);
- Cvar_RegisterVariable (&log_sync);
// support for the classic Quake option
-// COMMANDLINEOPTION: Console: -condebug logs console messages to qconsole.log with sync on (so it keeps every message up to a crash), see also log_file and log_sync
+// COMMANDLINEOPTION: Console: -condebug logs console messages to qconsole.log, see also log_file
if (COM_CheckParm ("-condebug") != 0)
- {
Cvar_SetQuick (&log_file, "qconsole.log");
- Cvar_SetValueQuick (&log_sync, 1);
- }
}
if (logfile != NULL || log_file.string[0] == '\0')
return;
- logfile = FS_Open (log_file.string, "at", false);
+ logfile = FS_Open (log_file.string, "a", false);
if (logfile != NULL)
{
strlcpy (crt_log_file, log_file.string, sizeof (crt_log_file));
void Log_ConPrint (const char *msg)
{
static qboolean inprogress = false;
+
// don't allow feedback loops with memory error reports
if (inprogress)
return;
inprogress = true;
+
// Until the host is completely initialized, we maintain a log queue
// to store the messages, since the log can't be started before
if (logqueue != NULL)
// If a log file is available
if (logfile != NULL)
- {
FS_Print (logfile, msg);
- if (log_sync.integer)
- FS_Flush (logfile);
- }
inprogress = false;
}
-/*
-================
-Log_Print
-================
-*/
-void Log_Print (const char *logfilename, const char *msg)
-{
- qfile_t *file;
- file = FS_Open(logfilename, "at", true);
- if (file)
- {
- FS_Print(file, msg);
- FS_Close(file);
- }
-}
-
/*
================
Log_Printf
{
qfile_t *file;
- file = FS_Open (logfilename, "at", true);
+ file = FS_Open (logfilename, "a", true);
if (file != NULL)
{
va_list argptr;
char msg[MAXPRINTMSG];
va_start(argptr,fmt);
- vsprintf(msg,fmt,argptr);
+ vsnprintf(msg,sizeof(msg),fmt,argptr);
va_end(argptr);
Con_Print(msg);
return; // don't confuse non-developers with techie stuff...
va_start(argptr,fmt);
- vsprintf(msg,fmt,argptr);
+ vsnprintf(msg,sizeof(msg),fmt,argptr);
va_end(argptr);
Con_Print(msg);
continue;
text = con_text + (i % con_totallines)*con_linewidth;
- DrawQ_String(0, v, text, con_linewidth, 8, 8, 1, 1, 1, 1, 0);
+ if (gamemode == GAME_NEXUIZ) {
+ int linewidth;
+
+ for (linewidth = con_linewidth; linewidth && text[linewidth-1] == ' '; linewidth--);
+ x = (vid.conwidth - linewidth * 8) / 2;
+ } else
+ x = 0;
+
+ DrawQ_String(x, v, text, con_linewidth, 8, 8, 1, 1, 1, 1, 0);
v += 8;
}