[Logging] Netcode Logging Unify (#2443)

* [Logging] Unify netcode logging

* More tweaks, generator

* Exclude OP_SpecialMesg at callback level

* Consolidate packet loggers

* Log at EQStream level instead of proxy

* Fix C->S

* Server to server logging

* C-S for Loginserver

* Hook UCS for C->S

* Update eqemu_logsys.h

* World C->S logging

* Translate opcodes through patch system for client to server

* Additional logging requests

* Add detailed opcode translation logging

* vStringFormat resiliency

* Translate loginserver C->S

* Simplify out message string (reduce copies) and ignore legacy formats

* Update eqemu_logsys.cpp

* Log file format

* Handle deprecated categories
This commit is contained in:
Chris Miles
2022-09-28 03:42:09 -05:00
committed by GitHub
parent 9d766bf5dc
commit 19791195e5
28 changed files with 875 additions and 1157 deletions
-1
View File
@@ -788,7 +788,6 @@ bool Client::SendAllPackets() {
if(eqs)
eqs->FastQueuePacket((EQApplicationPacket **)&cp->app, cp->ack_req);
clientpackets.pop_front();
Log(Logs::Moderate, Logs::PacketClientServer, "Transmitting a packet");
}
return true;
}
+7 -16
View File
@@ -447,17 +447,13 @@ void ClearMappedOpcode(EmuOpcode op)
// client methods
int Client::HandlePacket(const EQApplicationPacket *app)
{
if (LogSys.log_settings[Logs::LogCategory::Netcode].is_category_enabled == 1) {
char buffer[64];
app->build_header_dump(buffer);
Log(Logs::Detail, Logs::PacketClientServer, "Dispatch opcode: %s", buffer);
}
if (LogSys.log_settings[Logs::PacketClientServer].is_category_enabled == 1)
Log(Logs::General, Logs::PacketClientServer, "[%s - 0x%04x] [Size: %u]", OpcodeManager::EmuToName(app->GetOpcode()), app->GetOpcode(), app->Size());
if (LogSys.log_settings[Logs::PacketClientServerWithDump].is_category_enabled == 1)
Log(Logs::General, Logs::PacketClientServerWithDump, "[%s - 0x%04x] [Size: %u] %s", OpcodeManager::EmuToName(app->GetOpcode()), app->GetOpcode(), app->Size(), DumpPacketToString(app).c_str());
LogPacketClientServer(
"[{}] [{:#06x}] Size [{}] {}",
OpcodeManager::EmuToName(app->GetOpcode()),
eqs->GetOpcodeManager()->EmuToEQ(app->GetOpcode()),
app->Size(),
(LogSys.IsLogEnabled(Logs::Detail, Logs::PacketClientServer) ? DumpPacketToString(app) : "")
);
EmuOpcode opcode = app->GetOpcode();
if (opcode == OP_AckPacket) {
@@ -500,11 +496,6 @@ int Client::HandlePacket(const EQApplicationPacket *app)
args.push_back(const_cast<EQApplicationPacket*>(app));
parse->EventPlayer(EVENT_UNHANDLED_OPCODE, this, "", 0, &args);
if (LogSys.log_settings[Logs::PacketClientServerUnhandled].is_category_enabled == 1) {
char buffer[64];
app->build_header_dump(buffer);
Log(Logs::General, Logs::PacketClientServerUnhandled, "%s %s", buffer, DumpPacketToString(app).c_str());
}
break;
}
+5
View File
@@ -71,6 +71,11 @@ void command_logs(Client *c, const Seperator *sep)
break;
}
bool is_deprecated_category = Strings::Contains(fmt::format("{}", Logs::LogCategoryName[index]), "Deprecated");
if (is_deprecated_category) {
continue;
}
std::vector<std::string> gmsay;
for (int i = 0; i <= 3; i++) {
if (i == 2) {
+5
View File
@@ -322,6 +322,11 @@ public:
*/
static void GMSayHookCallBackProcess(uint16 log_category, std::string message)
{
// we don't want to loop up with chat messages
if (message.find("OP_SpecialMesg") != std::string::npos) {
return;
}
/**
* Cut messages down to 4000 max to prevent client crash
*/