Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

l_log.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Functions

void Log_Close (void)
FILELog_FilePointer (void)
void Log_Flush (void)
void Log_Open (char *filename)
void Log_Shutdown (void)
void QDECL Log_Write (char *fmt,...)
void QDECL Log_WriteTimeStamped (char *fmt,...)


Function Documentation

void Log_Close void   ) 
 

Definition at line 86 of file l_log.c.

00087 {
00088     if (!logfile.fp) return;
00089     if (fclose(logfile.fp))
00090     {
00091         botimport.Print(PRT_ERROR, "can't close log file %s\n", logfile.filename);
00092         return;
00093     } //end if
00094     logfile.fp = NULL;
00095     botimport.Print(PRT_MESSAGE, "Closed log %s\n", logfile.filename);
00096 } //end of the function Log_Close

FILE* Log_FilePointer void   ) 
 

Definition at line 155 of file l_log.c.

References logfile_s::fp, and logfile.

Referenced by BotDumpMatchTemplates(), BotDumpRandomStringList(), BotDumpReplyChat(), and BotDumpSynonymList().

00156 {
00157     return logfile.fp;
00158 } //end of the function Log_FilePointer

void Log_Flush void   ) 
 

Definition at line 165 of file l_log.c.

00166 {
00167     if (logfile.fp) fflush(logfile.fp);
00168 } //end of the function Log_Flush

void Log_Open char *  filename  ) 
 

Definition at line 58 of file l_log.c.

00059 {
00060     if (!LibVarValue("log", "0")) return;
00061     if (!filename || !strlen(filename))
00062     {
00063         botimport.Print(PRT_MESSAGE, "openlog <filename>\n");
00064         return;
00065     } //end if
00066     if (logfile.fp)
00067     {
00068         botimport.Print(PRT_ERROR, "log file %s is already opened\n", logfile.filename);
00069         return;
00070     } //end if
00071     logfile.fp = fopen(filename, "wb");
00072     if (!logfile.fp)
00073     {
00074         botimport.Print(PRT_ERROR, "can't open the log file %s\n", filename);
00075         return;
00076     } //end if
00077     strncpy(logfile.filename, filename, MAX_LOGFILENAMESIZE);
00078     botimport.Print(PRT_MESSAGE, "Opened log %s\n", logfile.filename);
00079 } //end of the function Log_Create

void Log_Shutdown void   ) 
 

Definition at line 103 of file l_log.c.

00104 {
00105     if (logfile.fp) Log_Close();
00106 } //end of the function Log_Shutdown

void QDECL Log_Write char *  fmt,
  ...
 

Definition at line 113 of file l_log.c.

00114 {
00115     va_list ap;
00116 
00117     if (!logfile.fp) return;
00118     va_start(ap, fmt);
00119     vfprintf(logfile.fp, fmt, ap);
00120     va_end(ap);
00121     //fprintf(logfile.fp, "\r\n");
00122     fflush(logfile.fp);
00123 } //end of the function Log_Write

void QDECL Log_WriteTimeStamped char *  fmt,
  ...
 

Definition at line 130 of file l_log.c.

00131 {
00132     va_list ap;
00133 
00134     if (!logfile.fp) return;
00135     fprintf(logfile.fp, "%d   %02d:%02d:%02d:%02d   ",
00136                     logfile.numwrites,
00137                     (int) (botlibglobals.time / 60 / 60),
00138                     (int) (botlibglobals.time / 60),
00139                     (int) (botlibglobals.time),
00140                     (int) ((int) (botlibglobals.time * 100)) -
00141                             ((int) botlibglobals.time) * 100);
00142     va_start(ap, fmt);
00143     vfprintf(logfile.fp, fmt, ap);
00144     va_end(ap);
00145     fprintf(logfile.fp, "\r\n");
00146     logfile.numwrites++;
00147     fflush(logfile.fp);
00148 } //end of the function Log_Write


Generated on Thu Aug 25 12:42:54 2005 for Quake III Arena by  doxygen 1.3.9.1