#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "../game/q_shared.h"
#include "../game/botlib.h"
#include "be_interface.h"
#include "l_libvar.h"
Include dependency graph for l_log.c:

Go to the source code of this file.
Data Structures | |
| struct | logfile_s |
Defines | |
| #define | MAX_LOGFILENAMESIZE 1024 |
Typedefs | |
| typedef logfile_s | logfile_t |
Functions | |
| void | Log_Close (void) |
| FILE * | Log_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,...) |
Variables | |
| logfile_t | logfile |
|
|
Definition at line 41 of file l_log.c. Referenced by Log_Open(). |
|
|
|
|
|
Definition at line 86 of file l_log.c. Referenced by Error(), Log_Shutdown(), and main(). 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
|
|
|
Definition at line 155 of file l_log.c. References logfile_s::fp, and logfile. Referenced by BotDumpMatchTemplates(), BotDumpRandomStringList(), BotDumpReplyChat(), and BotDumpSynonymList().
|
|
|
Definition at line 165 of file l_log.c.
|
|
|
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
|
|
|
Definition at line 103 of file l_log.c. Referenced by Export_BotLibShutdown().
|
|
||||||||||||
|
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
|
|
||||||||||||
|
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
|
|
|
Definition at line 50 of file l_log.c. Referenced by Log_Close(), Log_FilePointer(), Log_Flush(), Log_Open(), Log_Shutdown(), Log_Write(), and Log_WriteTimeStamped(). |
1.3.9.1