1
0
mirror of https://github.com/anope/anope.git synced 2026-07-10 23:23:13 +02:00

Improve protocol debug messages.

This commit is contained in:
Sadie Powell
2024-03-08 12:24:44 +00:00
parent 46b7064834
commit 1d0a836a2e
2 changed files with 44 additions and 13 deletions
+17 -12
View File
@@ -18,35 +18,40 @@
void Anope::Process(const Anope::string &buffer)
{
/* If debugging, log the buffer */
Log(LOG_RAWIO) << "Received: " << buffer;
if (buffer.empty())
return;
Anope::map<Anope::string> tags;
Anope::string source, command;
std::vector<Anope::string> params;
if (!IRCD->Parse(buffer, tags, source, command, params))
return;
Log(LOG_RAWIO) << "Received " << buffer;
if (Anope::ProtocolDebug)
{
if (tags.empty())
Log() << "No tags";
Log() << "\tNo tags";
else
for (Anope::map<Anope::string>::const_iterator it = tags.begin(); it != tags.end(); ++it)
Log() << "tags " << it->first << ": " << it->second;
{
for (const auto &[tname, tvalue] : tags)
Log() << "\tTag " << tname << ": " << tvalue;
}
Log() << "Source : " << (source.empty() ? "No source" : source);
Log() << "Command: " << command;
if (source.empty())
Log() << "\tNo source";
else
Log() << "\tSource: " << source;
Log() << "\tCommand: " << command;
if (params.empty())
Log() << "No params";
Log() << "\tNo params";
else
for (unsigned i = 0; i < params.size(); ++i)
Log() << "params " << i << ": " << params[i];
{
for (size_t i = 0; i < params.size(); ++i)
Log() << "\tParam " << i << ": " << params[i];
}
}
static const Anope::string proto_name = ModuleManager::FindFirstOf(PROTOCOL) ? ModuleManager::FindFirstOf(PROTOCOL)->name : "";