From 5739c2efa9e7a759649e48274f295b215efaeb94 Mon Sep 17 00:00:00 2001 From: click Date: Sun, 22 Aug 2010 16:33:43 +0200 Subject: Core: replace redirectional outStaticDebug with a copy of debug for future use and rewrite --HG-- branch : trunk --- src/server/shared/Logging/Log.cpp | 51 ++++++++++++++++++++++++++++++++------- 1 file changed, 42 insertions(+), 9 deletions(-) (limited to 'src/server/shared/Logging/Log.cpp') diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp index 500701d0491..6857ea649bb 100644 --- a/src/server/shared/Logging/Log.cpp +++ b/src/server/shared/Logging/Log.cpp @@ -734,16 +734,49 @@ void Log::outDebug(const char * str, ...) fflush(stdout); } -void Log::outStaticDebug(const char * fmt, ...) +void Log::outStaticDebug(const char * str, ...) { - #ifdef TRINITY_DEBUG - va_list ap; - char str[2048]; - va_start(ap, str); - vsnprintf(str, 2048, fmt, ap); - va_end(ap); - outDebug(str); - #endif + if (!str) + return; + + if (m_enableLogDB && m_dbLogLevel > LOGL_DETAIL) + { + va_list ap2; + va_start(ap2, str); + char nnew_str[MAX_QUERY_LEN]; + vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap2); + outDB(LOG_TYPE_DEBUG, nnew_str); + va_end(ap2); + } + + if( m_logLevel > LOGL_DETAIL ) + { + if (m_colored) + SetColor(true,m_colors[LOGL_DEBUG]); + + va_list ap; + va_start(ap, str); + vutf8printf(stdout, str, &ap); + va_end(ap); + + if(m_colored) + ResetColor(true); + + printf( "\n" ); + + if (logfile) + { + outTimestamp(logfile); + va_list ap; + va_start(ap, str); + vfprintf(logfile, str, ap); + va_end(ap); + + fprintf(logfile, "\n" ); + fflush(logfile); + } + } + fflush(stdout); } void Log::outStringInLine(const char * str, ...) -- cgit v1.2.3