+int con_linewidth;
+
+float con_cursorspeed = 4;
+
+#define CON_TEXTSIZE 131072
+
+// total lines in console scrollback
+int con_totallines;
+// lines up from bottom to display
+int con_backscroll;
+// where next message will be printed
+int con_current;
+// offset in current line for next print
+int con_x;
+char *con_text = 0;
+
+//seconds
+cvar_t con_notifytime = {CVAR_SAVE, "con_notifytime","3"};
+cvar_t con_notify = {CVAR_SAVE, "con_notify","4"};
+
+#define MAX_NOTIFYLINES 32
+// cl.time time the line was generated for transparent notify lines
+float con_times[MAX_NOTIFYLINES];
+
+int con_vislines;
+
+#define MAXCMDLINE 256
+extern char key_lines[32][MAXCMDLINE];
+extern int edit_line;
+extern int key_linepos;
+extern int key_insert;
+
+
+qboolean con_initialized;
+
+mempool_t *console_mempool;
+
+
+/*
+==============================================================================
+
+LOGGING
+
+==============================================================================
+*/
+
+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;
+
+qbyte* logqueue = NULL;
+size_t logq_ind = 0;
+size_t logq_size = 0;
+
+void Log_ConPrint (const char *msg);
+
+/*
+====================
+Log_Timestamp
+====================
+*/
+const char* Log_Timestamp (const char *desc)
+{
+ static char timestamp [128];
+ time_t crt_time;
+ const struct tm *crt_tm;
+ char timestring [64];
+
+ // Build the time stamp (ex: "Wed Jun 30 21:49:08 1993");
+ time (&crt_time);
+ crt_tm = localtime (&crt_time);
+ strftime (timestring, sizeof (timestring), "%a %b %d %H:%M:%S %Y", crt_tm);
+
+ if (desc != NULL)
+ snprintf (timestamp, sizeof (timestamp), "====== %s (%s) ======\n", desc, timestring);
+ else
+ snprintf (timestamp, sizeof (timestamp), "====== %s ======\n", timestring);
+
+ return timestamp;
+}
+
+
+/*
+====================
+Log_Init
+====================
+*/
+void Log_Init (void)
+{
+ Cvar_RegisterVariable (&log_file);
+ Cvar_RegisterVariable (&log_sync);
+
+ // support for the classic Quake option
+ if (COM_CheckParm ("-condebug") != 0)
+ {
+ Cvar_SetQuick (&log_file, "qconsole.log");
+ Cvar_SetValueQuick (&log_sync, 1);
+ unlink (va("%s/qconsole.log", fs_gamedir));
+ }
+
+ // Allocate a log queue
+ logq_size = 512;
+ logqueue = Mem_Alloc (tempmempool, logq_size);
+ logq_ind = 0;
+}
+
+
+/*
+====================
+Log_Open
+====================
+*/
+void Log_Open (void)
+{
+ if (logfile != NULL || log_file.string[0] == '\0')
+ return;
+
+ logfile = FS_Open (log_file.string, "at", false);
+ if (logfile != NULL)
+ {
+ strlcpy (crt_log_file, log_file.string, sizeof (crt_log_file));
+ FS_Print (logfile, Log_Timestamp ("Log started"));
+ }
+}