diff options
author | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-01-06 14:19:26 +0000 |
---|---|---|
committer | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-01-06 14:19:26 +0000 |
commit | 3adaf8788b65a84ec4266c6621d30679a95f546d (patch) | |
tree | da233eb45db1f482a4f2a86be9529c90edd76c8b /src/common | |
parent | ad95c2ba955e42d74afffbb6b9b333f69a3f1b1e (diff) | |
download | hercules-3adaf8788b65a84ec4266c6621d30679a95f546d.tar.gz hercules-3adaf8788b65a84ec4266c6621d30679a95f546d.tar.bz2 hercules-3adaf8788b65a84ec4266c6621d30679a95f546d.tar.xz hercules-3adaf8788b65a84ec4266c6621d30679a95f546d.zip |
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
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/core.c | 2 | ||||
-rw-r--r-- | src/common/malloc.c | 2 | ||||
-rw-r--r-- | src/common/showmsg.c | 18 | ||||
-rw-r--r-- | src/common/showmsg.h | 1 | ||||
-rw-r--r-- | src/common/socket.c | 12 |
5 files changed, 13 insertions, 22 deletions
diff --git a/src/common/core.c b/src/common/core.c index 301760759..b89cc3841 100644 --- a/src/common/core.c +++ b/src/common/core.c @@ -94,7 +94,7 @@ static void sig_proc(int sn) //run_flag = 0; // should we quit? break; case SIGPIPE: - ShowMessage ("Broken pipe found... closing socket\n"); // set to eof in socket.c + //ShowInfo ("Broken pipe found... closing socket\n"); // set to eof in socket.c break; // does nothing here #endif } diff --git a/src/common/malloc.c b/src/common/malloc.c index f2866e564..8b985bbd7 100644 --- a/src/common/malloc.c +++ b/src/common/malloc.c @@ -201,7 +201,7 @@ void* _mmalloc(size_t size, const char *file, int line, const char *func ) size_t size_hash; if (((long) size) < 0) { - printf("_mmalloc: %d\n", size); + ShowError("_mmalloc: %d\n", size); return 0; } 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)); diff --git a/src/common/showmsg.h b/src/common/showmsg.h index 31933f17a..998296b66 100644 --- a/src/common/showmsg.h +++ b/src/common/showmsg.h @@ -4,7 +4,6 @@ #ifndef _SHOWMSG_H_ #define _SHOWMSG_H_ -#define SHOW_DEBUG_MSG 1 // for help with the console colors look here: // http://www.edoceo.com/liberum/?doc=printf-with-color // some code explanation (used here): diff --git a/src/common/socket.c b/src/common/socket.c index 0173ee846..9bc49a3e0 100644 --- a/src/common/socket.c +++ b/src/common/socket.c @@ -817,7 +817,7 @@ static int connect_check(uint32 ip) { int result = connect_check_(ip); if( access_debug ) { - ShowMessage("connect_check: Connection from %d.%d.%d.%d %s\n", CONVIP(ip),result ? "allowed." : "denied!"); + ShowInfo("connect_check: Connection from %d.%d.%d.%d %s\n", CONVIP(ip),result ? "allowed." : "denied!"); } return result; } @@ -837,7 +837,7 @@ static int connect_check_(uint32 ip) for( i=0; i < access_allownum; ++i ){ if( (ip & access_allow[i].mask) == (access_allow[i].ip & access_allow[i].mask) ){ if( access_debug ){ - ShowMessage("connect_check: Found match from allow list:%d.%d.%d.%d IP:%d.%d.%d.%d Mask:%d.%d.%d.%d\n", + ShowInfo("connect_check: Found match from allow list:%d.%d.%d.%d IP:%d.%d.%d.%d Mask:%d.%d.%d.%d\n", CONVIP(ip), CONVIP(access_allow[i].ip), CONVIP(access_allow[i].mask)); @@ -850,7 +850,7 @@ static int connect_check_(uint32 ip) for( i=0; i < access_denynum; ++i ){ if( (ip & access_deny[i].mask) == (access_deny[i].ip & access_deny[i].mask) ){ if( access_debug ){ - ShowMessage("connect_check: Found match from deny list:%d.%d.%d.%d IP:%d.%d.%d.%d Mask:%d.%d.%d.%d\n", + ShowInfo("connect_check: Found match from deny list:%d.%d.%d.%d IP:%d.%d.%d.%d Mask:%d.%d.%d.%d\n", CONVIP(ip), CONVIP(access_deny[i].ip), CONVIP(access_deny[i].mask)); @@ -956,7 +956,7 @@ static int connect_check_clear(int tid, unsigned int tick, int id, int data) connect_history[i] = root.next; } if( access_debug ){ - ShowMessage("connect_check_clear: Cleared %d of %d from IP list.\n", clear, list); + ShowInfo("connect_check_clear: Cleared %d of %d from IP list.\n", clear, list); } return list; } @@ -1001,7 +1001,7 @@ int access_ipmask(const char* str, AccessControl* acc) } } if( access_debug ){ - ShowMessage("access_ipmask: Loaded IP:%d.%d.%d.%d mask:%d.%d.%d.%d\n", CONVIP(ip), CONVIP(mask)); + ShowInfo("access_ipmask: Loaded IP:%d.%d.%d.%d mask:%d.%d.%d.%d\n", CONVIP(ip), CONVIP(mask)); } acc->ip = ip; acc->mask = mask; @@ -1215,7 +1215,7 @@ void socket_init(void) } if( LOBYTE(wsaData.wVersion) != 2 || HIBYTE(wsaData.wVersion) != 0 ) { - printf("socket_init: WinSock version mismatch (2.0 or compatible required)!\n"); + ShowError("socket_init: WinSock version mismatch (2.0 or compatible required)!\n"); return; } } |