diff options
Diffstat (limited to 'src/common/showmsg.c')
-rw-r--r-- | src/common/showmsg.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/common/showmsg.c b/src/common/showmsg.c index fc1badd26..a69c73ba2 100644 --- a/src/common/showmsg.c +++ b/src/common/showmsg.c @@ -4,6 +4,8 @@ #include "../common/cbasetypes.h" #include "../common/strlib.h" // StringBuf #include "showmsg.h" +#include "core.h" //[Ind] - For SERVER_TYPE +#include "version.h" //[Ind] - For SERVER_TYPE values #include <stdio.h> #include <string.h> @@ -51,6 +53,8 @@ int stdout_with_ansisequence = 0; int msg_silent = 0; //Specifies how silent the console is. +int console_msg_log = 0;//[Ind] msg error logging + /////////////////////////////////////////////////////////////////////////////// /// static/dynamic buffer for the messages @@ -684,6 +688,29 @@ int _vShowMessage(enum msg_type flag, const char *string, va_list ap) return 1; } if( + ( flag == MSG_WARNING && console_msg_log&1 ) || + ( ( flag == MSG_ERROR || flag == MSG_SQL ) && console_msg_log&2 ) || + ( flag == MSG_DEBUG && console_msg_log&4 ) ) {//[Ind] + FILE *log = NULL; + if( (log = fopen(SERVER_TYPE == ATHENA_SERVER_MAP ? "./log/map-msg_log.log" : "./log/unknown.log","a+")) ) { + char timestring[255]; + time_t curtime; + time(&curtime); + strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime)); + fprintf(log,"(%s) [ %s ] : ", + timestring, + flag == MSG_WARNING ? "Warning" : + flag == MSG_ERROR ? "Error" : + flag == MSG_SQL ? "SQL Error" : + flag == MSG_DEBUG ? "Debug" : + "Unknown"); + va_copy(apcopy, ap); + vfprintf(log,string,apcopy); + va_end(apcopy); + fclose(log); + } + } + if( (flag == MSG_INFORMATION && msg_silent&1) || (flag == MSG_STATUS && msg_silent&2) || (flag == MSG_NOTICE && msg_silent&4) || |