void QDECL SV_PrintAdministrativeLog( const char *fmt, ... ) { va_list argptr; char msg[MAXPRINTMSG]; char inputmsg[MAXPRINTMSG]; struct tm *newtime; char* ltime; time_t realtime; va_start (argptr,fmt); Q_vsnprintf (inputmsg, sizeof(inputmsg), fmt, argptr); va_end (argptr); Com_UpdateRealtime(); realtime = Com_GetRealtime(); newtime = localtime( &realtime ); ltime = asctime( newtime ); ltime[strlen(ltime)-1] = 0; if(SV_UseUids()) Com_sprintf(msg, sizeof(msg), "%s - Admin %i with %i power %s\n", ltime, cmdInvoker.currentCmdInvoker, cmdInvoker.currentCmdPower, inputmsg); else Com_sprintf(msg, sizeof(msg), "%s - Admin %s with %i power %s\n", ltime, cmdInvoker.currentCmdInvokerGuid, cmdInvoker.currentCmdPower, inputmsg); Com_PrintAdministrativeLog( msg ); }
void QDECL SV_EnterLeaveLog( const char *fmt, ... ) { Sys_EnterCriticalSection(5); va_list argptr; char msg[MAXPRINTMSG]; char inputmsg[MAXPRINTMSG]; struct tm *newtime; char* ltime; time_t realtime; // logfile if ( com_logfile && com_logfile->integer ) { // TTimo: only open the qconsole.log if the filesystem is in an initialized state // also, avoid recursing in the qconsole.log opening (i.e. if fs_debug is on) va_start (argptr,fmt); Q_vsnprintf (inputmsg, sizeof(inputmsg), fmt, argptr); va_end (argptr); Com_UpdateRealtime(); realtime = Com_GetRealtime(); newtime = localtime( &realtime ); ltime = asctime( newtime ); ltime[strlen(ltime)-1] = 0; if ( !enterleavelogfile && FS_Initialized()) { enterleavelogfile = FS_FOpenFileAppend( "enterleave.log" ); // force it to not buffer so we get valid if ( enterleavelogfile ){ FS_ForceFlush(enterleavelogfile); FS_Write(va("\nLogfile opened on %s\n\n", ltime), strlen(va("\nLogfile opened on %s\n\n", ltime)), enterleavelogfile); } } if ( enterleavelogfile && FS_Initialized()) { Com_sprintf(msg, sizeof(msg), "%s: %s\n", ltime, inputmsg); FS_Write(msg, strlen(msg), enterleavelogfile); } } Sys_LeaveCriticalSection(5); }
void QDECL Com_PrintAdministrativeLog( const char *msg ) { Sys_EnterCriticalSection(5); struct tm *newtime; char* ltime; time_t realtime; // logfile if ( com_logfile && com_logfile->integer ) { // TTimo: only open the qconsole.log if the filesystem is in an initialized state // also, avoid recursing in the qconsole.log opening (i.e. if fs_debug is on) if ( !adminlogfile && FS_Initialized()) { Com_UpdateRealtime(); realtime = Com_GetRealtime(); newtime = localtime( &realtime ); ltime = asctime( newtime ); ltime[strlen(ltime)-1] = 0; adminlogfile = FS_FOpenFileAppend( "adminactions.log" ); // force it to not buffer so we get valid if ( adminlogfile ){ FS_ForceFlush(adminlogfile); FS_Write(va("\nLogfile opened on %s\n\n", ltime), strlen(va("\nLogfile opened on %s\n\n", ltime)), adminlogfile); } } if ( adminlogfile && FS_Initialized()) { FS_Write(msg, strlen(msg), adminlogfile); } } Sys_LeaveCriticalSection(5); }
void QDECL SV_PrintAdministrativeLog( const char *fmt, ... ) { va_list argptr; char msg[MAXPRINTMSG]; char inputmsg[MAXPRINTMSG]; struct tm *newtime; char* ltime; time_t realtime; va_start (argptr,fmt); Q_vsnprintf (inputmsg, sizeof(inputmsg), fmt, argptr); va_end (argptr); Com_UpdateRealtime(); realtime = Com_GetRealtime(); newtime = localtime( &realtime ); ltime = asctime( newtime ); ltime[strlen(ltime)-1] = 0; Com_sprintf(msg, sizeof(msg), "%s - Admin %i with %i power %s\n", ltime, Cmd_GetInvokerUID(), Cmd_GetInvokerPower(), inputmsg); Com_PrintAdministrativeLog( msg ); }