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.6 by pippijn, Mon Dec 11 19:46:46 2006 UTC vs.
Revision 1.7 by root, Sat Dec 30 10:16:10 2006 UTC

36 */ 36 */
37 37
38void 38void
39LOG (LogLevel logLevel, const char *format, ...) 39LOG (LogLevel logLevel, const char *format, ...)
40{ 40{
41 char buf[20480]; /* This needs to be really really big - larger
42 * than any other buffer, since that buffer may
43 * need to be put in this one.
44 */
45 char tbuf[20480];
46
47 time_t curtime = time (NULL);
48 struct tm *ptime = localtime (&curtime);
49
50 strftime (tbuf, 256, "%Y-%m-%d %H:%M:%S ", ptime);
51
52 va_list ap;
53
54 va_start (ap, format);
55
56 buf[0] = '\0';
57 if (logLevel <= settings.debug) 41 if (logLevel <= settings.debug)
58 { 42 {
43 char buf[20480]; /* This needs to be really really big - larger
44 * than any other buffer, since that buffer may
45 * need to be put in this one.
46 */
47 char tbuf[20480];
48
49 time_t curtime = time (NULL);
50 struct tm *ptime = localtime (&curtime);
51
52 strftime (tbuf, 256, "%Y-%m-%d %H:%M:%S ", ptime);
53
54 va_list ap;
55
56 va_start (ap, format);
57
59 vsnprintf (buf, sizeof (buf), format, ap); 58 vsnprintf (buf, sizeof (buf), format, ap);
60 strncat (tbuf, buf, 20460); 59 strncat (tbuf, buf, 20460);
61 fputs (tbuf, logfile); 60 fputs (tbuf, logfile);
61 fputs (tbuf, stderr);
62
63 va_end (ap);
62 } 64 }
63 if (!exiting && !trying_emergency_save && logLevel == llevError && ++nroferrors > MAX_ERRORS)
64 {
65 exiting = 1;
66 if (!trying_emergency_save)
67 emergency_save (0);
68 }
69 va_end (ap);
70} 65}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines