version 1.10 | | version 1.11 |
---|
| | |
/* | | /* |
* static char *rcsid_loger_c = | | * static char *rcsid_loger_c = |
* "$Id: logger.c,v 1.10 2005/07/15 13:51:49 ryo_saeba Exp $ "; | | * "$Id: logger.c,v 1.11 2006/06/05 12:07:26 tchize Exp $ "; |
*/ | | */ |
| | |
/* | | /* |
| | |
* See include/logger.h for possible logLevels. Messages with llevInfo | | * See include/logger.h for possible logLevels. Messages with llevInfo |
* and llevError are always printed, regardless of debug mode. | | * and llevError are always printed, regardless of debug mode. |
*/ | | */ |
| | static char* loglevel_names[] = {"[Error] ", |
| | "[Info] ", |
| | "[Debug] ", |
| | "[Monster] "}; |
void LOG (LogLevel logLevel, const char *format, ...) | | void LOG (LogLevel logLevel, const char *format, ...) |
{ | | { |
char buf[20480]; /* This needs to be really really big - larger | | char buf[20480]; /* This needs to be really really big - larger |
| | |
{ | | { |
vsprintf(buf, format, ap); | | vsprintf(buf, format, ap); |
#ifdef WIN32 /* ---win32 change log handling for win32 */ | | #ifdef WIN32 /* ---win32 change log handling for win32 */ |
| | fputs(loglevel_names[logLevel], logfile); /* wrote to file or stdout */ |
fputs(buf, logfile); /* wrote to file or stdout */ | | fputs(buf, logfile); /* wrote to file or stdout */ |
#ifdef DEBUG /* if we have a debug version, we want see ALL output */ | | #ifdef DEBUG /* if we have a debug version, we want see ALL output */ |
fflush(logfile); /* so flush this! */ | | fflush(logfile); /* so flush this! */ |
#endif | | #endif |
if(logfile != stderr) /* if was it a logfile wrote it to screen too */ | | if(logfile != stderr){ /* if was it a logfile wrote it to screen too */ |
| | fputs(loglevel_names[logLevel], stderr); |
fputs(buf, stderr); | | fputs(buf, stderr); |
| | } |
#else | | #else |
| | fputs(loglevel_names[logLevel], logfile); |
fputs(buf, logfile); | | fputs(buf, logfile); |
#endif | | #endif |
} | | } |