Implement Packet logs with dumps

- Category: 41: Packet: Server -> Client With Dump
	- Category: 42: Packet: Server -> Client With Dump
	See: http://wiki.eqemulator.org/p?Logging_System_Overhaul#packet-logging-levels
This commit is contained in:
Akkadius 2015-02-02 00:10:22 -06:00
parent e1c49f93e2
commit f2667cee23
9 changed files with 29 additions and 12 deletions

View File

@ -1,5 +1,12 @@
EQEMu Changelog (Started on Sept 24, 2003 15:50) EQEMu Changelog (Started on Sept 24, 2003 15:50)
------------------------------------------------------- -------------------------------------------------------
== 02/02/2015 ==
Akkadius: Implement Packet logs with dumps
- Category: 41: Packet: Server -> Client With Dump
- Category: 42: Packet: Server -> Client With Dump
See: http://wiki.eqemulator.org/p?Logging_System_Overhaul#packet-logging-levels
== 02/01/2015 == == 02/01/2015 ==
demonstar55: Add quest debugging to lua demonstar55: Add quest debugging to lua
eq.debug("Test debug level implicit 1") eq.debug("Test debug level implicit 1")

View File

@ -511,12 +511,8 @@ void DumpPacket(const EQApplicationPacket* app, bool iShowInfo) {
// DumpPacketAscii(app->pBuffer, app->size); // DumpPacketAscii(app->pBuffer, app->size);
} }
std::string DumpPacketToString(const EQApplicationPacket* app, bool iShowInfo){ std::string DumpPacketToString(const EQApplicationPacket* app){
std::ostringstream out; std::ostringstream out;
if (iShowInfo) {
out << "Dumping Applayer: 0x" << std::hex << std::setfill('0') << std::setw(4) << app->GetOpcode() << std::dec;
out << " size:" << app->size << std::endl;
}
out << DumpPacketHexToString(app->pBuffer, app->size); out << DumpPacketHexToString(app->pBuffer, app->size);
return out.str(); return out.str();
} }

View File

@ -147,6 +147,6 @@ protected:
}; };
extern void DumpPacket(const EQApplicationPacket* app, bool iShowInfo = false); extern void DumpPacket(const EQApplicationPacket* app, bool iShowInfo = false);
extern std::string DumpPacketToString(const EQApplicationPacket* app, bool iShowInfo = false); extern std::string DumpPacketToString(const EQApplicationPacket* app);
#endif #endif

View File

@ -556,14 +556,18 @@ void EQStream::FastQueuePacket(EQApplicationPacket **p, bool ack_req)
void EQStream::SendPacket(uint16 opcode, EQApplicationPacket *p) void EQStream::SendPacket(uint16 opcode, EQApplicationPacket *p)
{ {
uint32 chunksize,used; uint32 chunksize, used;
uint32 length; uint32 length;
// DumpPacket(p);
if (Log.log_settings[Logs::Server_Client_Packet].is_category_enabled == 1){ if (Log.log_settings[Logs::Server_Client_Packet].is_category_enabled == 1){
if (p->GetOpcode() != OP_SpecialMesg){ if (p->GetOpcode() != OP_SpecialMesg){
Log.Out(Logs::General, Logs::Server_Client_Packet, "[%s - 0x%04x] [Size: %u] %s", OpcodeManager::EmuToName(p->GetOpcode()), p->GetOpcode(), p->Size(), DumpPacketToString(p).c_str()); Log.Out(Logs::General, Logs::Server_Client_Packet, "[%s - 0x%04x] [Size: %u]", OpcodeManager::EmuToName(p->GetOpcode()), p->GetOpcode(), p->Size());
}
}
if (Log.log_settings[Logs::Server_Client_Packet_With_Dump].is_category_enabled == 1){
if (p->GetOpcode() != OP_SpecialMesg){
Log.Out(Logs::General, Logs::Server_Client_Packet_With_Dump, "[%s - 0x%04x] [Size: %u] %s", OpcodeManager::EmuToName(p->GetOpcode()), p->GetOpcode(), p->Size(), DumpPacketToString(p).c_str());
} }
} }

View File

@ -80,6 +80,8 @@ namespace Logs {
QuestDebug, QuestDebug,
Server_Client_Packet, Server_Client_Packet,
Client_Server_Packet_Unhandled, Client_Server_Packet_Unhandled,
Server_Client_Packet_With_Dump,
Client_Server_Packet_With_Dump,
MaxCategoryID /* Don't Remove this*/ MaxCategoryID /* Don't Remove this*/
}; };
@ -126,6 +128,8 @@ namespace Logs {
"Quest Debug", "Quest Debug",
"Packet :: Server -> Client", "Packet :: Server -> Client",
"Packet :: Client -> Server Unhandled", "Packet :: Client -> Server Unhandled",
"Packet :: Server -> Client (Dump)",
"Packet :: Client -> Server (Dump)",
}; };
} }

View File

@ -30,7 +30,7 @@
Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt
*/ */
#define CURRENT_BINARY_DATABASE_VERSION 9074 #define CURRENT_BINARY_DATABASE_VERSION 9075
#define COMPILE_DATE __DATE__ #define COMPILE_DATE __DATE__
#define COMPILE_TIME __TIME__ #define COMPILE_TIME __TIME__
#ifndef WIN32 #ifndef WIN32

View File

@ -328,6 +328,7 @@
9072|2015_01_30_merc_attack_delay.sql|SHOW COLUMNS FROM `merc_stats` LIKE 'attack_delay'|empty| 9072|2015_01_30_merc_attack_delay.sql|SHOW COLUMNS FROM `merc_stats` LIKE 'attack_delay'|empty|
9073|2015_01_31_character_item_recast.sql|SHOW TABLES LIKE 'character_item_recast'|empty| 9073|2015_01_31_character_item_recast.sql|SHOW TABLES LIKE 'character_item_recast'|empty|
9074|2015_02_01_logsys_packet_logs.sql|SELECT * FROM `logsys_categories` WHERE `log_category_description` LIKE 'Packet: Server -> Client'|empty| 9074|2015_02_01_logsys_packet_logs.sql|SELECT * FROM `logsys_categories` WHERE `log_category_description` LIKE 'Packet: Server -> Client'|empty|
9075|2015_02_02_logsys_packet_logs_with_dump.sql|SELECT * FROM `logsys_categories` WHERE `log_category_description` LIKE 'Packet: Server -> Client With Dump'|empty|
# Upgrade conditions: # Upgrade conditions:
# This won't be needed after this system is implemented, but it is used database that are not # This won't be needed after this system is implemented, but it is used database that are not

View File

@ -0,0 +1,2 @@
REPLACE INTO `logsys_categories` (`log_category_id`, `log_category_description`) VALUES ('41', 'Packet: Server -> Client With Dump');
REPLACE INTO `logsys_categories` (`log_category_id`, `log_category_description`) VALUES ('42', 'Packet: Server -> Client With Dump');

View File

@ -405,7 +405,10 @@ int Client::HandlePacket(const EQApplicationPacket *app)
} }
if (Log.log_settings[Logs::Client_Server_Packet].is_category_enabled == 1) if (Log.log_settings[Logs::Client_Server_Packet].is_category_enabled == 1)
Log.Out(Logs::General, Logs::Client_Server_Packet, "[%s - 0x%04x] [Size: %u] %s", OpcodeManager::EmuToName(app->GetOpcode()), app->GetOpcode(), app->Size(), DumpPacketToString(app).c_str()); Log.Out(Logs::General, Logs::Client_Server_Packet, "[%s - 0x%04x] [Size: %u]", OpcodeManager::EmuToName(app->GetOpcode()), app->GetOpcode(), app->Size());
if (Log.log_settings[Logs::Client_Server_Packet_With_Dump].is_category_enabled == 1)
Log.Out(Logs::General, Logs::Client_Server_Packet_With_Dump, "[%s - 0x%04x] [Size: %u] %s", OpcodeManager::EmuToName(app->GetOpcode()), app->GetOpcode(), app->Size(), DumpPacketToString(app).c_str());
EmuOpcode opcode = app->GetOpcode(); EmuOpcode opcode = app->GetOpcode();
if (opcode == OP_AckPacket) { if (opcode == OP_AckPacket) {