mirror of
https://github.com/mangosfour/server.git
synced 2025-12-27 10:37:02 +00:00
[8798] Partly revert and optimize [8797]
* Revert realmd changes: - typos in prev. commit prevent correct work of realmd code. - useless log login packets - and really horrible idea log of patch packets (how nice convert some MB in hex strings) * Revert output world packet format to more readable old but output timestamp * Drop outWorld, but use explcit fprintf calls into new outWorldPacketDump. Not nice have 16 flush calls at hex line.
This commit is contained in:
parent
07aa44992b
commit
ea7100ff63
8 changed files with 39 additions and 112 deletions
|
|
@ -21,6 +21,7 @@
|
|||
#include "Policies/SingletonImp.h"
|
||||
#include "Config/ConfigEnv.h"
|
||||
#include "Util.h"
|
||||
#include "ByteBuffer.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
|
|
@ -227,7 +228,7 @@ void Log::Initialize()
|
|||
charLogfile = openLogFile("CharLogFile","CharLogTimestamp","a");
|
||||
dberLogfile = openLogFile("DBErrorLogFile",NULL,"a");
|
||||
raLogfile = openLogFile("RaLogFile",NULL,"a");
|
||||
worldLogfile = openLogFile("WorldLogFile",NULL,"a");
|
||||
worldLogfile = openLogFile("WorldLogFile","WorldLogTimestamp","a");
|
||||
|
||||
// Main log file settings
|
||||
m_includeTime = sConfig.GetBoolDefault("LogTime", false);
|
||||
|
|
@ -698,19 +699,28 @@ void Log::outChar(const char * str, ... )
|
|||
}
|
||||
}
|
||||
|
||||
void Log::outWorld( const char * str, ... )
|
||||
void Log::outWorldPacketDump( uint32 socket, uint32 opcode, char const* opcodeName, ByteBuffer const* packet, bool incoming )
|
||||
{
|
||||
if (!str)
|
||||
if (!worldLogfile)
|
||||
return;
|
||||
|
||||
if (worldLogfile)
|
||||
outTimestamp(worldLogfile);
|
||||
|
||||
fprintf(worldLogfile,"\n%s:\nSOCKET: %u\nLENGTH: %u\nOPCODE: %s (0x%.4X)\nDATA:\n",
|
||||
incoming ? "CLIENT" : "SERVER",
|
||||
socket, packet->size(), opcodeName, opcode);
|
||||
|
||||
size_t p = 0;
|
||||
while (p < packet->size())
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, str);
|
||||
vfprintf(worldLogfile, str, args);
|
||||
va_end(args);
|
||||
fflush(worldLogfile);
|
||||
for (size_t j = 0; j < 16 && p < packet->size(); ++j)
|
||||
fprintf(worldLogfile, "%.2X ", (*packet)[p++]);
|
||||
|
||||
fprintf(worldLogfile, "\n");
|
||||
}
|
||||
|
||||
fprintf(worldLogfile, "\n\n");
|
||||
fflush(worldLogfile);
|
||||
}
|
||||
|
||||
void Log::outCharDump( const char * str, uint32 account_id, uint32 guid, const char * name )
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
#include "Policies/Singleton.h"
|
||||
|
||||
class Config;
|
||||
class ByteBuffer;
|
||||
|
||||
// bitmask
|
||||
enum LogFilters
|
||||
|
|
@ -110,8 +111,8 @@ class Log : public MaNGOS::Singleton<Log, MaNGOS::ClassLevelLockable<Log, ACE_Th
|
|||
// any log level
|
||||
void outChar( const char * str, ... ) ATTR_PRINTF(2,3);
|
||||
// any log level
|
||||
void outWorld( const char * str, ... ) ATTR_PRINTF(2,3);
|
||||
// any log level
|
||||
void outWorldPacketDump( uint32 socket, uint32 opcode, char const* opcodeName, ByteBuffer const* packet, bool incoming );
|
||||
// any log level
|
||||
void outCharDump( const char * str, uint32 account_id, uint32 guid, const char * name );
|
||||
void outRALog( const char * str, ... ) ATTR_PRINTF(2,3);
|
||||
void SetLogLevel(char * Level);
|
||||
|
|
@ -124,7 +125,6 @@ class Log : public MaNGOS::Singleton<Log, MaNGOS::ClassLevelLockable<Log, ACE_Th
|
|||
uint32 getLogFilter() const { return m_logFilter; }
|
||||
bool IsOutDebug() const { return m_logLevel > 2 || (m_logFileLevel > 2 && logfile); }
|
||||
bool IsOutCharDump() const { return m_charLog_Dump; }
|
||||
bool IsLogWorld() const { return (worldLogfile); }
|
||||
bool IsIncludeTime() const { return m_includeTime; }
|
||||
private:
|
||||
FILE* openLogFile(char const* configFileName,char const* configTimeStampFlag, char const* mode);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "8797"
|
||||
#define REVISION_NR "8798"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue