diff --git a/changelog.txt b/changelog.txt index 279e28418..d5312dd4e 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,12 @@ 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 == demonstar55: Add quest debugging to lua eq.debug("Test debug level implicit 1") diff --git a/common/eq_packet.cpp b/common/eq_packet.cpp index 45eccb7de..e01f6a3f8 100644 --- a/common/eq_packet.cpp +++ b/common/eq_packet.cpp @@ -511,12 +511,8 @@ void DumpPacket(const EQApplicationPacket* app, bool iShowInfo) { // DumpPacketAscii(app->pBuffer, app->size); } -std::string DumpPacketToString(const EQApplicationPacket* app, bool iShowInfo){ +std::string DumpPacketToString(const EQApplicationPacket* app){ 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); return out.str(); } \ No newline at end of file diff --git a/common/eq_packet.h b/common/eq_packet.h index e3c8182c6..ed90d132a 100644 --- a/common/eq_packet.h +++ b/common/eq_packet.h @@ -147,6 +147,6 @@ protected: }; 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 diff --git a/common/eq_stream.cpp b/common/eq_stream.cpp index 402d3d90b..be1ae50d4 100644 --- a/common/eq_stream.cpp +++ b/common/eq_stream.cpp @@ -556,14 +556,18 @@ void EQStream::FastQueuePacket(EQApplicationPacket **p, bool ack_req) void EQStream::SendPacket(uint16 opcode, EQApplicationPacket *p) { - uint32 chunksize,used; + uint32 chunksize, used; uint32 length; - // DumpPacket(p); - if (Log.log_settings[Logs::Server_Client_Packet].is_category_enabled == 1){ 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()); } } diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 5cd110c01..a99b3b439 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -80,6 +80,8 @@ namespace Logs { QuestDebug, Server_Client_Packet, Client_Server_Packet_Unhandled, + Server_Client_Packet_With_Dump, + Client_Server_Packet_With_Dump, MaxCategoryID /* Don't Remove this*/ }; @@ -126,6 +128,8 @@ namespace Logs { "Quest Debug", "Packet :: Server -> Client", "Packet :: Client -> Server Unhandled", + "Packet :: Server -> Client (Dump)", + "Packet :: Client -> Server (Dump)", }; } diff --git a/common/version.h b/common/version.h index 05ce3a53e..ee9196985 100644 --- a/common/version.h +++ b/common/version.h @@ -30,7 +30,7 @@ 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_TIME __TIME__ #ifndef WIN32 diff --git a/utils/sql/db_update_manifest.txt b/utils/sql/db_update_manifest.txt index f72b90aff..9d370c5fa 100644 --- a/utils/sql/db_update_manifest.txt +++ b/utils/sql/db_update_manifest.txt @@ -328,6 +328,7 @@ 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| 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: # This won't be needed after this system is implemented, but it is used database that are not diff --git a/utils/sql/git/required/2015_02_02_logsys_packet_logs_with_dump.sql b/utils/sql/git/required/2015_02_02_logsys_packet_logs_with_dump.sql new file mode 100644 index 000000000..7da9af532 --- /dev/null +++ b/utils/sql/git/required/2015_02_02_logsys_packet_logs_with_dump.sql @@ -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'); \ No newline at end of file diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 6558b6dee..199e37356 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -405,7 +405,10 @@ int Client::HandlePacket(const EQApplicationPacket *app) } 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(); if (opcode == OP_AckPacket) {