From: Crossfire C. r. messages.
<cro...@li...> - 2006-06-06 03:32:14
|
Module Name: crossfire Committed By: tchize Date: Mon Jun 5 12:07:26 UTC 2006 Modified Files: crossfire/common: logger.c Log Message: Improved log message (to see priority of error in log file). This change is part of unit tests writing. Start of context diffs Index: crossfire/common/logger.c diff -c crossfire/common/logger.c:1.10 crossfire/common/logger.c:1.11 *** crossfire/common/logger.c:1.10 Fri Jul 15 06:51:49 2005 --- crossfire/common/logger.c Mon Jun 5 05:07:26 2006 *************** *** 1,6 **** /* * static char *rcsid_loger_c = ! * "$Id: logger.c,v 1.10 2005/07/15 13:51:49 ryo_saeba Exp $ "; */ /* --- 1,6 ---- /* * static char *rcsid_loger_c = ! * "$Id: logger.c,v 1.11 2006/06/05 12:07:26 tchize Exp $ "; */ /* *************** *** 39,45 **** * See include/logger.h for possible logLevels. Messages with llevInfo * and llevError are always printed, regardless of debug mode. */ ! void LOG (LogLevel logLevel, const char *format, ...) { char buf[20480]; /* This needs to be really really big - larger --- 39,48 ---- * See include/logger.h for possible logLevels. Messages with llevInfo * and llevError are always printed, regardless of debug mode. */ ! static char* loglevel_names[] = {"[Error] ", ! "[Info] ", ! "[Debug] ", ! "[Monster] "}; void LOG (LogLevel logLevel, const char *format, ...) { char buf[20480]; /* This needs to be really really big - larger *************** *** 55,67 **** { vsprintf(buf, format, ap); #ifdef WIN32 /* ---win32 change log handling for win32 */ ! fputs(buf, logfile); /* wrote to file or stdout */ #ifdef DEBUG /* if we have a debug version, we want see ALL output */ fflush(logfile); /* so flush this! */ #endif ! if(logfile != stderr) /* if was it a logfile wrote it to screen too */ ! fputs(buf, stderr); #else fputs(buf, logfile); #endif } --- 58,74 ---- { vsprintf(buf, format, ap); #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 */ #ifdef DEBUG /* if we have a debug version, we want see ALL output */ fflush(logfile); /* so flush this! */ #endif ! if(logfile != stderr){ /* if was it a logfile wrote it to screen too */ ! fputs(loglevel_names[logLevel], stderr); ! fputs(buf, stderr); ! } #else + fputs(loglevel_names[logLevel], logfile); fputs(buf, logfile); #endif } |