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

Show account names in log messages

This commit is contained in:
Adam
2014-05-20 12:19:26 -04:00
parent 4034b3054a
commit 20ce170024
2 changed files with 31 additions and 32 deletions
+26 -32
View File
@@ -137,6 +137,27 @@ Log::~Log()
Config->LogInfos[i].ProcessMessage(this);
}
Anope::string Log::FormatSource() const
{
if (u)
if (nc)
return this->u->GetMask() + " (" + this->nc->display + ")";
else
return this->u->GetMask();
else if (nc)
return nc->display;
return "";
}
Anope::string Log::FormatCommand() const
{
Anope::string buffer = FormatSource() + " used " + (source != NULL && !source->command.empty() ? source->command : this->c->name) + " ";
if (this->ci)
buffer += "on " + this->ci->name + " ";
return buffer;
}
Anope::string Log::BuildPrefix() const
{
Anope::string buffer;
@@ -147,61 +168,34 @@ Anope::string Log::BuildPrefix() const
{
if (!this->c)
break;
buffer += "ADMIN: ";
Anope::string cname = source != NULL && !source->command.empty() ? source->command : this->c->name;
if (this->u)
buffer += this->u->GetMask() + " used " + cname + " ";
else if (this->nc)
buffer += this->nc->display + " used " + cname + " ";
if (this->ci)
buffer += "on " + this->ci->name + " ";
buffer += "ADMIN: " + FormatCommand();
break;
}
case LOG_OVERRIDE:
{
if (!this->c)
break;
buffer += "OVERRIDE: ";
Anope::string cname = source != NULL && !source->command.empty() ? source->command : this->c->name;
if (this->u)
buffer += this->u->GetMask() + " used " + cname + " ";
else if (this->nc)
buffer += this->nc->display + " used " + cname + " ";
if (this->ci)
buffer += "on " + this->ci->name + " ";
buffer += "OVERRIDE: " + FormatCommand();
break;
}
case LOG_COMMAND:
{
if (!this->c)
break;
buffer += "COMMAND: ";
Anope::string cname = source != NULL && !source->command.empty() ? source->command : this->c->name;
if (this->u)
buffer += this->u->GetMask() + " used " + cname + " ";
else if (this->source)
buffer += this->source->GetNick() + " used " + cname + " ";
else if (this->nc)
buffer += this->nc->display + " used " + cname + " ";
if (this->ci)
buffer += "on " + this->ci->name + " ";
buffer += "COMMAND: " + FormatCommand();
break;
}
case LOG_CHANNEL:
{
if (!this->chan)
break;
buffer += "CHANNEL: ";
if (this->u)
buffer += this->u->GetMask() + " " + this->category + " " + this->chan->name + " ";
else
buffer += this->category + " " + this->chan->name + " ";
buffer += "CHANNEL: " + FormatSource() + " " + this->category + " " + this->chan->name + " ";
break;
}
case LOG_USER:
{
if (this->u)
buffer += "USERS: " + this->u->GetMask() + " ";
buffer += "USERS: " + FormatSource() + " ";
break;
}
case LOG_SERVER: