ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/logger.C
(Generate patch)

Comparing deliantra/server/common/logger.C (file contents):
Revision 1.2 by root, Sun Aug 27 16:15:11 2006 UTC vs.
Revision 1.3 by root, Tue Aug 29 08:01:35 2006 UTC

1/* 1/*
2 * static char *rcsid_loger_c = 2 * static char *rcsid_loger_c =
3 * "$Id: logger.C,v 1.2 2006/08/27 16:15:11 root Exp $ "; 3 * "$Id: logger.C,v 1.3 2006/08/29 08:01:35 root Exp $ ";
4 */ 4 */
5 5
6/* 6/*
7 CrossFire, A Multiplayer game for X-windows 7 CrossFire, A Multiplayer game for X-windows
8 8
41 */ 41 */
42 42
43void LOG (LogLevel logLevel, const char *format, ...) 43void LOG (LogLevel logLevel, const char *format, ...)
44{ 44{
45 char buf[20480]; /* This needs to be really really big - larger 45 char buf[20480]; /* This needs to be really really big - larger
46 * than any other buffer, since that buffer may 46 * than any other buffer, since that buffer may
47 * need to be put in this one. 47 * need to be put in this one.
48 */ 48 */
49 char tbuf[20480]; 49 char tbuf[20480];
50 50
51 time_t curtime = time (NULL); 51 time_t curtime = time (NULL);
52 struct tm *ptime = localtime (&curtime); 52 struct tm *ptime = localtime (&curtime);
53 53
60 if (logLevel <= settings.debug) 60 if (logLevel <= settings.debug)
61 { 61 {
62 vsnprintf(buf, sizeof (buf), format, ap); 62 vsnprintf(buf, sizeof (buf), format, ap);
63 strncat(tbuf, buf, 20460); 63 strncat(tbuf, buf, 20460);
64#ifdef WIN32 /* ---win32 change log handling for win32 */ 64#ifdef WIN32 /* ---win32 change log handling for win32 */
65 fputs(tbuf, logfile); /* wrote to file or stdout */ 65 fputs(tbuf, logfile); /* wrote to file or stdout */
66#ifdef DEBUG /* if we have a debug version, we want see ALL output */ 66#ifdef DEBUG /* if we have a debug version, we want see ALL output */
67 fflush(logfile); /* so flush this! */ 67 fflush(logfile); /* so flush this! */
68#endif 68#endif
69 if(logfile != stderr) /* if was it a logfile wrote it to screen too */ 69 if(logfile != stderr) /* if was it a logfile wrote it to screen too */
70 fputs(tbuf, stderr); 70 fputs(tbuf, stderr);
71#else 71#else
72 fputs(tbuf, logfile); 72 fputs(tbuf, logfile);
73#endif 73#endif
74 } 74 }
75 if (!exiting && !trying_emergency_save && 75 if (!exiting && !trying_emergency_save &&

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines