From 3adaf8788b65a84ec4266c6621d30679a95f546d Mon Sep 17 00:00:00 2001 From: ultramage Date: Sun, 6 Jan 2008 14:19:26 +0000 Subject: Modified showmsg code to not attach a timestamp to MSG_NONE-type messages, generated by ShowMessage(). It now works exactly like printf(). Removed/replaced all printf calls in the code. Added a new flag to setting 'console_silent', for filtering debug messages. Silenced the "Broken pipe found" and "Server running in debug mode" messages. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12020 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/common/showmsg.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'src/common/showmsg.c') diff --git a/src/common/showmsg.c b/src/common/showmsg.c index fa744f0e4..c50716bed 100644 --- a/src/common/showmsg.c +++ b/src/common/showmsg.c @@ -525,9 +525,6 @@ int FPRINTF(HANDLE handle, const char *fmt, ...) #else // not _WIN32 -//#define VPRINTF vprintf -//#define PRINTF printf - #define is_console(file) (0!=isatty(fileno(file))) //vprintf_without_ansiformats @@ -674,12 +671,8 @@ int FPRINTF(FILE *file, const char *fmt, ...) char timestamp_format[20] = ""; //For displaying Timestamps -// by MC Cameri int _vShowMessage(enum msg_type flag, const char *string, va_list ap) { - // _ShowMessage MUST be used instead of printf as of 10/24/2004. - // Return: 0 = Successful, 1 = Failed. -// int ret = 0; char prefix[100]; #if defined(DEBUGLOGMAP) || defined(DEBUGLOGCHAR) || defined(DEBUGLOGLOGIN) FILE *fp; @@ -689,19 +682,18 @@ int _vShowMessage(enum msg_type flag, const char *string, va_list ap) ShowError("Empty string passed to _vShowMessage().\n"); return 1; } - if ( -#if !defined(SHOW_DEBUG_MSG) - (flag == MSG_DEBUG) || -#endif + if( (flag == MSG_INFORMATION && msg_silent&1) || (flag == MSG_STATUS && msg_silent&2) || (flag == MSG_NOTICE && msg_silent&4) || (flag == MSG_WARNING && msg_silent&8) || (flag == MSG_ERROR && msg_silent&16) || - (flag == MSG_SQL && msg_silent&16)) + (flag == MSG_SQL && msg_silent&16) || + (flag == MSG_DEBUG && msg_silent&32) + ) return 0; //Do not print it. - if (timestamp_format[0]) + if (timestamp_format[0] && flag != MSG_NONE) { //Display time format. [Skotlex] time_t t = time(NULL); strftime(prefix, 80, timestamp_format, localtime(&t)); -- cgit v1.2.3-70-g09d2