Core/Logging: Add optional binary packet logger usable with WowPacketParser, and remove the now useless WorldLog.

TODO: Port this to .pkt 3.1 format
This commit is contained in:
kaelima
2012-06-04 08:52:12 +02:00
parent 31a08f5ddc
commit d86246b861
5 changed files with 89 additions and 186 deletions
+7 -39
View File
@@ -42,7 +42,7 @@
#include "WorldSession.h"
#include "WorldSocketMgr.h"
#include "Log.h"
#include "WorldLog.h"
#include "PacketLog.h"
#include "ScriptMgr.h"
#include "AccountMgr.h"
@@ -152,7 +152,7 @@ const std::string& WorldSocket::GetRemoteAddress (void) const
return m_Address;
}
int WorldSocket::SendPacket(const WorldPacket& pct)
int WorldSocket::SendPacket(WorldPacket const& pct)
{
ACE_GUARD_RETURN (LockType, Guard, m_OutBufferLock, -1);
@@ -160,24 +160,8 @@ int WorldSocket::SendPacket(const WorldPacket& pct)
return -1;
// Dump outgoing packet.
if (sWorldLog->LogWorld())
{
sWorldLog->outTimestampLog ("SERVER:\nSOCKET: %u\nLENGTH: %u\nOPCODE: %s (0x%.4X)\nDATA:\n",
(uint32) get_handle(),
pct.size(),
LookupOpcodeName (pct.GetOpcode()),
pct.GetOpcode());
uint32 p = 0;
while (p < pct.size())
{
for (uint32 j = 0; j < 16 && p < pct.size(); j++)
sWorldLog->outLog("%.2X ", const_cast<WorldPacket&>(pct)[p++]);
sWorldLog->outLog("\n");
}
sWorldLog->outLog("\n");
}
if (sPacketLog->CanLogPacket())
sPacketLog->LogPacket(pct, SERVER_TO_CLIENT);
// Create a copy of the original packet; this is to avoid issues if a hook modifies it.
sScriptMgr->OnPacketSend(this, WorldPacket(pct));
@@ -674,7 +658,7 @@ int WorldSocket::schedule_wakeup_output (GuardType& g)
return 0;
}
int WorldSocket::ProcessIncoming (WorldPacket* new_pct)
int WorldSocket::ProcessIncoming(WorldPacket* new_pct)
{
ACE_ASSERT (new_pct);
@@ -687,24 +671,8 @@ int WorldSocket::ProcessIncoming (WorldPacket* new_pct)
return -1;
// Dump received packet.
if (sWorldLog->LogWorld())
{
sWorldLog->outTimestampLog ("CLIENT:\nSOCKET: %u\nLENGTH: %u\nOPCODE: %s (0x%.4X)\nDATA:\n",
(uint32) get_handle(),
new_pct->size(),
LookupOpcodeName (new_pct->GetOpcode()),
new_pct->GetOpcode());
uint32 p = 0;
while (p < new_pct->size())
{
for (uint32 j = 0; j < 16 && p < new_pct->size(); j++)
sWorldLog->outLog ("%.2X ", (*new_pct)[p++]);
sWorldLog->outLog ("\n");
}
sWorldLog->outLog ("\n");
}
if (sPacketLog->CanLogPacket())
sPacketLog->LogPacket(*new_pct, CLIENT_TO_SERVER);
try
{