[11604] Drop outDebugInLine, outMenu.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
Vinolentus 2011-06-05 17:54:36 +04:00 committed by VladimirMangos
parent b68a88573f
commit d99e9dc611
4 changed files with 39 additions and 87 deletions

View file

@ -414,10 +414,16 @@ class ByteBuffer
if (!sLog.HasLogLevelOrHigher(LOG_LVL_DEBUG)) // optimize disabled debug output if (!sLog.HasLogLevelOrHigher(LOG_LVL_DEBUG)) // optimize disabled debug output
return; return;
sLog.outDebug("STORAGE_SIZE: %lu", (unsigned long)size() ); std::ostringstream ss;
for(uint32 i = 0; i < size(); ++i) ss << "STORAGE_SIZE: " << size() << "\n";
sLog.outDebugInLine("%u - ", read<uint8>(i) );
sLog.outDebug(" "); if (sLog.IsIncludeTime())
ss << " ";
for (size_t i = 0; i < size(); ++i)
ss << uint32(read<uint8>(i)) << " - ";
sLog.outDebug(ss.str().c_str());
} }
void textlike() const void textlike() const
@ -425,10 +431,16 @@ class ByteBuffer
if (!sLog.HasLogLevelOrHigher(LOG_LVL_DEBUG)) // optimize disabled debug output if (!sLog.HasLogLevelOrHigher(LOG_LVL_DEBUG)) // optimize disabled debug output
return; return;
sLog.outDebug("STORAGE_SIZE: %lu", (unsigned long)size() ); std::ostringstream ss;
for(uint32 i = 0; i < size(); ++i) ss << "STORAGE_SIZE: " << size() << "\n";
sLog.outDebugInLine("%c", read<uint8>(i) );
sLog.outDebug(" "); if (sLog.IsIncludeTime())
ss << " ";
for (size_t i = 0; i < size(); ++i)
ss << read<uint8>(i);
sLog.outDebug(ss.str().c_str());
} }
void hexlike() const void hexlike() const
@ -436,37 +448,40 @@ class ByteBuffer
if (!sLog.HasLogLevelOrHigher(LOG_LVL_DEBUG)) // optimize disabled debug output if (!sLog.HasLogLevelOrHigher(LOG_LVL_DEBUG)) // optimize disabled debug output
return; return;
uint32 j = 1, k = 1; std::ostringstream ss;
sLog.outDebug("STORAGE_SIZE: %lu", (unsigned long)size() ); ss << "STORAGE_SIZE: " << size() << "\n";
if (sLog.IsIncludeTime()) 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)))) if ((i == (j * 8)) && ((i != (k * 16))))
{ {
sLog.outDebugInLine("| %02X ", read<uint8>(i)); ss << "| ";
++j; ++j;
} }
else if (i == (k * 16)) else if (i == (k * 16))
{ {
sLog.outDebugInLine("\n"); ss << "\n";
if(sLog.IsIncludeTime())
sLog.outDebugInLine(" ");
sLog.outDebugInLine("%02X ", read<uint8>(i)); if (sLog.IsIncludeTime())
ss << " ";
++k; ++k;
++j; ++j;
} }
else
{ char buf[4];
sLog.outDebugInLine("%02X ", read<uint8>(i)); snprintf(buf, 4, "%02X", read<uint8>(i));
} ss << buf << " ";
} }
sLog.outDebugInLine("\n"); sLog.outDebug(ss.str().c_str());
} }
private: private:
// limited for internal use because can "append" any unexpected type (like pointer and etc) with hard detection problem // limited for internal use because can "append" any unexpected type (like pointer and etc) with hard detection problem
template <typename T> void append(T value) template <typename T> void append(T value)

View file

@ -589,34 +589,6 @@ void Log::outDetail( const char * str, ... )
fflush(stdout); 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, ... ) void Log::outDebug( const char * str, ... )
{ {
if (!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, ... ) void Log::outRALog( const char * str, ... )
{ {
if (!str) if (!str)

View file

@ -130,11 +130,8 @@ class Log : public MaNGOS::Singleton<Log, MaNGOS::ClassLevelLockable<Log, ACE_Th
// log level >= 2 // log level >= 2
void outDetail( const char * str, ... ) ATTR_PRINTF(2,3); void outDetail( const char * str, ... ) ATTR_PRINTF(2,3);
// log level >= 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); 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 void outErrorDb(); // any log level
// any log level // any log level
void outErrorDb( const char * str, ... ) ATTR_PRINTF(2,3); void outErrorDb( const char * str, ... ) ATTR_PRINTF(2,3);

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "11603" #define REVISION_NR "11604"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__