diff --git a/src/shared/ByteBuffer.h b/src/shared/ByteBuffer.h index 9fb1baed9..2c5864c64 100644 --- a/src/shared/ByteBuffer.h +++ b/src/shared/ByteBuffer.h @@ -414,10 +414,16 @@ class ByteBuffer if (!sLog.HasLogLevelOrHigher(LOG_LVL_DEBUG)) // optimize disabled debug output return; - sLog.outDebug("STORAGE_SIZE: %lu", (unsigned long)size() ); - for(uint32 i = 0; i < size(); ++i) - sLog.outDebugInLine("%u - ", read(i) ); - sLog.outDebug(" "); + std::ostringstream ss; + ss << "STORAGE_SIZE: " << size() << "\n"; + + if (sLog.IsIncludeTime()) + ss << " "; + + for (size_t i = 0; i < size(); ++i) + ss << uint32(read(i)) << " - "; + + sLog.outDebug(ss.str().c_str()); } void textlike() const @@ -425,10 +431,16 @@ class ByteBuffer if (!sLog.HasLogLevelOrHigher(LOG_LVL_DEBUG)) // optimize disabled debug output return; - sLog.outDebug("STORAGE_SIZE: %lu", (unsigned long)size() ); - for(uint32 i = 0; i < size(); ++i) - sLog.outDebugInLine("%c", read(i) ); - sLog.outDebug(" "); + std::ostringstream ss; + ss << "STORAGE_SIZE: " << size() << "\n"; + + if (sLog.IsIncludeTime()) + ss << " "; + + for (size_t i = 0; i < size(); ++i) + ss << read(i); + + sLog.outDebug(ss.str().c_str()); } void hexlike() const @@ -436,37 +448,40 @@ class ByteBuffer if (!sLog.HasLogLevelOrHigher(LOG_LVL_DEBUG)) // optimize disabled debug output return; - uint32 j = 1, k = 1; - sLog.outDebug("STORAGE_SIZE: %lu", (unsigned long)size() ); + std::ostringstream ss; + ss << "STORAGE_SIZE: " << size() << "\n"; if (sLog.IsIncludeTime()) - sLog.outDebugInLine(" "); + ss << " "; - for(uint32 i = 0; i < size(); ++i) + size_t j = 1, k = 1; + + for (size_t i = 0; i < size(); ++i) { if ((i == (j * 8)) && ((i != (k * 16)))) { - sLog.outDebugInLine("| %02X ", read(i)); + ss << "| "; ++j; } else if (i == (k * 16)) { - sLog.outDebugInLine("\n"); - if(sLog.IsIncludeTime()) - sLog.outDebugInLine(" "); + ss << "\n"; - sLog.outDebugInLine("%02X ", read(i)); + if (sLog.IsIncludeTime()) + ss << " "; ++k; ++j; } - else - { - sLog.outDebugInLine("%02X ", read(i)); - } + + char buf[4]; + snprintf(buf, 4, "%02X", read(i)); + ss << buf << " "; + } - sLog.outDebugInLine("\n"); + sLog.outDebug(ss.str().c_str()); } + private: // limited for internal use because can "append" any unexpected type (like pointer and etc) with hard detection problem template void append(T value) diff --git a/src/shared/Log.cpp b/src/shared/Log.cpp index f99a4ba6e..075a9ef4c 100644 --- a/src/shared/Log.cpp +++ b/src/shared/Log.cpp @@ -589,34 +589,6 @@ void Log::outDetail( const char * str, ... ) fflush(stdout); } -void Log::outDebugInLine( const char * str, ... ) -{ - if (!str) - return; - - if (m_logLevel >= LOG_LVL_DEBUG) - { - if (m_colored) - SetColor(true,m_colors[LogDebug]); - - va_list ap; - va_start(ap, str); - vutf8printf(stdout, str, &ap); - va_end(ap); - - if (m_colored) - ResetColor(true); - } - - if (logfile && m_logFileLevel >= LOG_LVL_DEBUG) - { - va_list ap; - va_start(ap, str); - vfprintf(logfile, str, ap); - va_end(ap); - } -} - void Log::outDebug( const char * str, ... ) { if (!str) @@ -770,38 +742,6 @@ void Log::outCharDump( const char * str, uint32 account_id, uint32 guid, const c } } -void Log::outMenu( const char * str, ... ) -{ - if (!str) - return; - - SetColor(true,m_colors[LogNormal]); - - if (m_includeTime) - outTime(); - - va_list ap; - - va_start(ap, str); - vutf8printf(stdout, str, &ap); - va_end(ap); - - ResetColor(true); - - if (logfile) - { - outTimestamp(logfile); - - va_start(ap, str); - vfprintf(logfile, str, ap); - va_end(ap); - - fprintf(logfile, "\n" ); - fflush(logfile); - } - fflush(stdout); -} - void Log::outRALog( const char * str, ... ) { if (!str) diff --git a/src/shared/Log.h b/src/shared/Log.h index 1e869923e..8502d4421 100644 --- a/src/shared/Log.h +++ b/src/shared/Log.h @@ -130,11 +130,8 @@ class Log : public MaNGOS::Singleton= 2 void outDetail( const char * str, ... ) ATTR_PRINTF(2,3); // log level >= 3 - void outDebugInLine( const char * str, ... ) ATTR_PRINTF(2,3); - // log level >= 3 void outDebug( const char * str, ... ) ATTR_PRINTF(2,3); - // any log level - void outMenu( const char * str, ... ) ATTR_PRINTF(2,3); + void outErrorDb(); // any log level // any log level void outErrorDb( const char * str, ... ) ATTR_PRINTF(2,3); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 279169434..31794afa9 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "11603" + #define REVISION_NR "11604" #endif // __REVISION_NR_H__