mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-08 17:19:01 -05:00
Convert debug logging from string concatenation to format strings.
When running in normal mode this will prevent a bunch of expensive string concatenation.
This commit is contained in:
parent
cdad978bf6
commit
b9fee8b43d
@ -1213,7 +1213,7 @@ public:
|
||||
} \
|
||||
catch (const CoreException& _exception_ ## EVENT) \
|
||||
{ \
|
||||
ServerInstance->Logs.Debug("MODULE", _mod->ModuleFile + " threw an exception in " # EVENT ": " + (_exception_ ## EVENT).GetReason()); \
|
||||
ServerInstance->Logs.Debug("MODULE", "{} threw an exception in " # EVENT ": {}", _mod->ModuleFile, (_exception_ ## EVENT).GetReason()); \
|
||||
} \
|
||||
} \
|
||||
} while (false)
|
||||
@ -1240,7 +1240,7 @@ public:
|
||||
} \
|
||||
catch (const CoreException& _exception_ ## EVENT) \
|
||||
{ \
|
||||
ServerInstance->Logs.Debug("MODULE", _mod->ModuleFile + " threw an exception in " # EVENT ": " + (_exception_ ## EVENT).GetReason()); \
|
||||
ServerInstance->Logs.Debug("MODULE", "{} threw an exception in " # EVENT ": {}", _mod->ModuleFile, (_exception_ ## EVENT).GetReason()); \
|
||||
} \
|
||||
} \
|
||||
} while (false)
|
||||
|
@ -58,7 +58,7 @@ bool BanCacheManager::RemoveIfExpired(BanCacheHash::iterator& it)
|
||||
if (ServerInstance->Time() < it->second->Expiry)
|
||||
return false;
|
||||
|
||||
ServerInstance->Logs.Debug("BANCACHE", "Hit on " + it->first + " is out of date, removing!");
|
||||
ServerInstance->Logs.Debug("BANCACHE", "Hit on {} is out of date, removing!", it->first);
|
||||
delete it->second;
|
||||
it = BanHash.erase(it);
|
||||
return true;
|
||||
@ -67,7 +67,7 @@ bool BanCacheManager::RemoveIfExpired(BanCacheHash::iterator& it)
|
||||
void BanCacheManager::RemoveEntries(const std::string& type, bool positive)
|
||||
{
|
||||
if (positive)
|
||||
ServerInstance->Logs.Debug("BANCACHE", "BanCacheManager::RemoveEntries(): Removing positive hits for " + type);
|
||||
ServerInstance->Logs.Debug("BANCACHE", "BanCacheManager::RemoveEntries(): Removing positive hits for {}", type);
|
||||
else
|
||||
ServerInstance->Logs.Debug("BANCACHE", "BanCacheManager::RemoveEntries(): Removing all negative hits");
|
||||
|
||||
@ -93,7 +93,7 @@ void BanCacheManager::RemoveEntries(const std::string& type, bool positive)
|
||||
if (remove)
|
||||
{
|
||||
/* we need to remove this one. */
|
||||
ServerInstance->Logs.Debug("BANCACHE", "BanCacheManager::RemoveEntries(): Removing a hit on " + i->first);
|
||||
ServerInstance->Logs.Debug("BANCACHE", "BanCacheManager::RemoveEntries(): Removing a hit on {}", i->first);
|
||||
delete b;
|
||||
i = BanHash.erase(i);
|
||||
}
|
||||
|
@ -167,7 +167,7 @@ Membership* Channel::JoinUser(LocalUser* user, std::string cname, bool override,
|
||||
{
|
||||
if (!user->IsFullyConnected())
|
||||
{
|
||||
ServerInstance->Logs.Debug("CHANNELS", "Attempted to join partially connected user " + user->uuid + " to channel " + cname);
|
||||
ServerInstance->Logs.Debug("CHANNELS", "Attempted to join partially connected user {} to channel {}", user->uuid, cname);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -217,7 +217,7 @@ Membership* Channel::ForceJoin(User* user, const std::string* privs, bool bursti
|
||||
{
|
||||
if (IS_SERVER(user))
|
||||
{
|
||||
ServerInstance->Logs.Debug("CHANNELS", "Attempted to join server user " + user->uuid + " to channel " + this->name);
|
||||
ServerInstance->Logs.Debug("CHANNELS", "Attempted to join server user {} to channel {}", user->uuid, this->name);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -740,7 +740,7 @@ void ConfigReaderThread::OnStop()
|
||||
{
|
||||
try
|
||||
{
|
||||
ServerInstance->Logs.Debug("MODULE", "Rehashing " + modname);
|
||||
ServerInstance->Logs.Debug("MODULE", "Rehashing {}", modname);
|
||||
mod->ReadConfig(status);
|
||||
}
|
||||
catch (const CoreException& modex)
|
||||
|
@ -85,7 +85,8 @@ CmdResult CommandKick::Handle(User* user, const Params& parameters)
|
||||
// If the current membership id is not equal to the one in the message then the user rejoined
|
||||
if (memb->id != Membership::IdFromString(parameters[2]))
|
||||
{
|
||||
ServerInstance->Logs.Debug(MODNAME, "Dropped KICK due to membership id mismatch: " + ConvToStr(memb->id) + " != " + parameters[2]);
|
||||
ServerInstance->Logs.Debug(MODNAME, "Dropped KICK due to membership id mismatch: {} != {}",
|
||||
memb->id, parameters[2]);
|
||||
return CmdResult::FAILURE;
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ private:
|
||||
if (pos + name.length() + 2 > output_size)
|
||||
throw Exception(creator, "Unable to pack name");
|
||||
|
||||
ServerInstance->Logs.Debug(MODNAME, "Packing name " + name);
|
||||
ServerInstance->Logs.Debug(MODNAME, "Packing name {}", name);
|
||||
|
||||
irc::sepstream sep(name, '.');
|
||||
std::string token;
|
||||
@ -127,7 +127,7 @@ private:
|
||||
if (name.empty())
|
||||
throw Exception(creator, "Unable to unpack name - no name");
|
||||
|
||||
ServerInstance->Logs.Debug(MODNAME, "Unpack name " + name);
|
||||
ServerInstance->Logs.Debug(MODNAME, "Unpack name {}", name);
|
||||
|
||||
return name;
|
||||
}
|
||||
@ -250,7 +250,7 @@ private:
|
||||
}
|
||||
|
||||
if (!record.name.empty() && !record.rdata.empty())
|
||||
ServerInstance->Logs.Debug(MODNAME, record.name + " -> " + record.rdata);
|
||||
ServerInstance->Logs.Debug(MODNAME, "{} -> {}", record.name, record.rdata);
|
||||
|
||||
return record;
|
||||
}
|
||||
@ -296,7 +296,8 @@ public:
|
||||
unsigned short arcount = (input[packet_pos] << 8) | input[packet_pos + 1];
|
||||
packet_pos += 2;
|
||||
|
||||
ServerInstance->Logs.Debug(MODNAME, "qdcount: " + ConvToStr(qdcount) + " ancount: " + ConvToStr(ancount) + " nscount: " + ConvToStr(nscount) + " arcount: " + ConvToStr(arcount));
|
||||
ServerInstance->Logs.Debug(MODNAME, "qdcount: {} ancount: {} nscount: {} arcount: {}",
|
||||
qdcount, ancount, nscount, arcount);
|
||||
|
||||
if (qdcount != 1)
|
||||
throw Exception(creator, "Question count != 1 in incoming packet");
|
||||
@ -407,7 +408,7 @@ class MyManager final
|
||||
*/
|
||||
bool CheckCache(DNS::Request* req, const DNS::Question& question)
|
||||
{
|
||||
ServerInstance->Logs.Critical(MODNAME, "cache: Checking cache for " + question.name);
|
||||
ServerInstance->Logs.Critical(MODNAME, "cache: Checking cache for {}", question.name);
|
||||
|
||||
cache_map::iterator it = this->cache.find(question);
|
||||
if (it == this->cache.end())
|
||||
@ -420,7 +421,7 @@ class MyManager final
|
||||
return false;
|
||||
}
|
||||
|
||||
ServerInstance->Logs.Debug(MODNAME, "cache: Using cached result for " + question.name);
|
||||
ServerInstance->Logs.Debug(MODNAME, "cache: Using cached result for {}", question.name);
|
||||
record.cached = true;
|
||||
req->OnLookupComplete(&record);
|
||||
return true;
|
||||
@ -446,7 +447,7 @@ class MyManager final
|
||||
ResourceRecord& rr = r.answers.front();
|
||||
// Set TTL to what we've determined to be the lowest
|
||||
rr.ttl = cachettl;
|
||||
ServerInstance->Logs.Debug(MODNAME, "cache: added cache for " + rr.name + " -> " + rr.rdata + " ttl: " + ConvToStr(rr.ttl));
|
||||
ServerInstance->Logs.Debug(MODNAME, "cache: added cache for {} -> {} ttl: {}", rr.name, rr.rdata, rr.ttl);
|
||||
this->cache[r.question] = r;
|
||||
}
|
||||
|
||||
@ -511,7 +512,8 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
ServerInstance->Logs.Debug(MODNAME, "Processing request to lookup " + req->question.name + " of type " + ConvToStr(req->question.type) + " to " + this->myserver.addr());
|
||||
ServerInstance->Logs.Debug(MODNAME, "Processing request to lookup {} of type {} to {}",
|
||||
req->question.name, (int)req->question.type, this->myserver.addr());
|
||||
|
||||
/* Create an id */
|
||||
unsigned int tries = 0;
|
||||
@ -740,7 +742,7 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
ServerInstance->Logs.Debug(MODNAME, "Lookup complete for " + request->question.name);
|
||||
ServerInstance->Logs.Debug(MODNAME, "Lookup complete for {}", request->question.name);
|
||||
this->stats_success++;
|
||||
request->OnLookupComplete(&recv_packet);
|
||||
this->AddCache(recv_packet);
|
||||
|
@ -187,7 +187,7 @@ public:
|
||||
catch (const DNS::Exception& e)
|
||||
{
|
||||
delete res_forward;
|
||||
ServerInstance->Logs.Debug(MODNAME, "Error in resolver: " + e.GetReason());
|
||||
ServerInstance->Logs.Debug(MODNAME, "Error in resolver: {}", e.GetReason());
|
||||
|
||||
HandleError(user, "There was an internal error resolving your host");
|
||||
}
|
||||
@ -236,7 +236,7 @@ public:
|
||||
{
|
||||
this->dnsLookup.Unset(user);
|
||||
delete res_reverse;
|
||||
ServerInstance->Logs.Debug(MODNAME, "Error in resolver: " + e.GetReason());
|
||||
ServerInstance->Logs.Debug(MODNAME, "Error in resolver: {}", e.GetReason());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -427,7 +427,7 @@ public:
|
||||
|
||||
void Submit(SQL::Query* q, const std::string& qs) override
|
||||
{
|
||||
ServerInstance->Logs.Debug(MODNAME, "Executing MySQL query: " + qs);
|
||||
ServerInstance->Logs.Debug(MODNAME, "Executing MySQL query: {}", qs);
|
||||
Parent()->Dispatcher->LockQueue();
|
||||
Parent()->qq.emplace_back(q, qs, this);
|
||||
Parent()->Dispatcher->UnlockQueueWakeup();
|
||||
|
@ -454,7 +454,7 @@ restart:
|
||||
|
||||
void Submit(SQL::Query* req, const std::string& q) override
|
||||
{
|
||||
ServerInstance->Logs.Debug(MODNAME, "Executing PostgreSQL query: " + q);
|
||||
ServerInstance->Logs.Debug(MODNAME, "Executing PostgreSQL query: {}", q);
|
||||
if (qinprog.q.empty())
|
||||
{
|
||||
DoQuery(QueueItem(req, q));
|
||||
|
@ -174,7 +174,7 @@ public:
|
||||
|
||||
void Submit(SQL::Query* query, const std::string& q) override
|
||||
{
|
||||
ServerInstance->Logs.Debug(MODNAME, "Executing SQLite3 query: " + q);
|
||||
ServerInstance->Logs.Debug(MODNAME, "Executing SQLite3 query: {}", q);
|
||||
Query(query, q);
|
||||
delete query;
|
||||
}
|
||||
|
@ -1148,14 +1148,14 @@ class ModuleSSLGnuTLS final
|
||||
{
|
||||
if (!insp::equalsci(tag->getString("provider", "gnutls", 1), "gnutls"))
|
||||
{
|
||||
ServerInstance->Logs.Debug(MODNAME, "Ignoring non-GnuTLS <sslprofile> tag at " + tag->source.str());
|
||||
ServerInstance->Logs.Debug(MODNAME, "Ignoring non-GnuTLS <sslprofile> tag at {}", tag->source.str());
|
||||
continue;
|
||||
}
|
||||
|
||||
const std::string name = tag->getString("name");
|
||||
if (name.empty())
|
||||
{
|
||||
ServerInstance->Logs.Warning(MODNAME, "Ignoring <sslprofile> tag without name at " + tag->source.str());
|
||||
ServerInstance->Logs.Warning(MODNAME, "Ignoring <sslprofile> tag without name at {}", tag->source.str());
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -987,14 +987,14 @@ class ModuleSSLOpenSSL final
|
||||
{
|
||||
if (!insp::equalsci(tag->getString("provider", "openssl", 1), "openssl"))
|
||||
{
|
||||
ServerInstance->Logs.Debug(MODNAME, "Ignoring non-OpenSSL <sslprofile> tag at " + tag->source.str());
|
||||
ServerInstance->Logs.Debug(MODNAME, "Ignoring non-OpenSSL <sslprofile> tag at {}", tag->source.str());
|
||||
continue;
|
||||
}
|
||||
|
||||
const std::string name = tag->getString("name");
|
||||
if (name.empty())
|
||||
{
|
||||
ServerInstance->Logs.Warning(MODNAME, "Ignoring <sslprofile> tag without name at " + tag->source.str());
|
||||
ServerInstance->Logs.Warning(MODNAME, "Ignoring <sslprofile> tag without name at {}", tag->source.str());
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -780,7 +780,7 @@ void ModuleFilter::OnDecodeMetadata(Extensible* target, const std::string& extna
|
||||
}
|
||||
catch (const ModuleException& e)
|
||||
{
|
||||
ServerInstance->Logs.Debug(MODNAME, "Error when unserializing filter: " + e.GetReason());
|
||||
ServerInstance->Logs.Debug(MODNAME, "Error when unserializing filter: {}", e.GetReason());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -347,7 +347,7 @@ public:
|
||||
}
|
||||
catch (const ModuleException& e)
|
||||
{
|
||||
ServerInstance->Logs.Debug(MODNAME, "Ident exception: " + e.GetReason());
|
||||
ServerInstance->Logs.Debug(MODNAME, "Ident exception: {}", e.GetReason());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ CmdResult CommandIJoin::HandleRemote(RemoteUser* user, Params& params)
|
||||
{
|
||||
// Desync detected, recover
|
||||
// Ignore the join and send RESYNC, this will result in the remote server sending all channel data to us
|
||||
ServerInstance->Logs.Debug(MODNAME, "Received IJOIN for nonexistent channel: " + params[0]);
|
||||
ServerInstance->Logs.Debug(MODNAME, "Received IJOIN for nonexistent channel: {}", params[0]);
|
||||
|
||||
CmdBuilder("RESYNC").push(params[0]).Unicast(user);
|
||||
|
||||
@ -58,7 +58,7 @@ CmdResult CommandIJoin::HandleRemote(RemoteUser* user, Params& params)
|
||||
|
||||
CmdResult CommandResync::HandleServer(TreeServer* server, CommandBase::Params& params)
|
||||
{
|
||||
ServerInstance->Logs.Debug(MODNAME, "Resyncing " + params[0]);
|
||||
ServerInstance->Logs.Debug(MODNAME, "Resyncing {}", params[0]);
|
||||
auto* chan = ServerInstance->Channels.Find(params[0]);
|
||||
if (!chan)
|
||||
{
|
||||
|
@ -35,7 +35,8 @@ CmdResult CommandSInfo::HandleServer(TreeServer* server, CommandBase::Params& pa
|
||||
else if (irc::equals(key, "desc"))
|
||||
{
|
||||
// Only sent when the description of a server changes because of a rehash; not sent on burst
|
||||
ServerInstance->Logs.Debug(MODNAME, "Server description of " + server->GetName() + " changed: " + value);
|
||||
ServerInstance->Logs.Debug(MODNAME, "Server description of {} changed: {}",
|
||||
server->GetName(), value);
|
||||
server->SetDesc(value);
|
||||
}
|
||||
else if (irc::equals(key, "rawbranch"))
|
||||
|
@ -200,7 +200,7 @@ void UserManager::AddUser(int socket, ListenSocket* via, const irc::sockets::soc
|
||||
if (!b->Type.empty() && !New->exempt)
|
||||
{
|
||||
/* user banned */
|
||||
ServerInstance->Logs.Debug("BANCACHE", "Positive hit for " + New->GetAddress());
|
||||
ServerInstance->Logs.Debug("BANCACHE", "Positive hit for {}", New->GetAddress());
|
||||
|
||||
if (!ServerInstance->Config->XLineMessage.empty())
|
||||
New->WriteNumeric(ERR_YOUREBANNEDCREEP, ServerInstance->Config->XLineMessage);
|
||||
@ -212,7 +212,7 @@ void UserManager::AddUser(int socket, ListenSocket* via, const irc::sockets::soc
|
||||
}
|
||||
else
|
||||
{
|
||||
ServerInstance->Logs.Debug("BANCACHE", "Negative hit for " + New->GetAddress());
|
||||
ServerInstance->Logs.Debug("BANCACHE", "Negative hit for {}", New->GetAddress());
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -241,13 +241,13 @@ void UserManager::QuitUser(User* user, const std::string& quitmessage, const std
|
||||
{
|
||||
if (user->quitting)
|
||||
{
|
||||
ServerInstance->Logs.Debug("USERS", "BUG: Tried to quit quitting user: " + user->nick);
|
||||
ServerInstance->Logs.Debug("USERS", "BUG: Tried to quit quitting user: {}", user->nick);
|
||||
return;
|
||||
}
|
||||
|
||||
if (IS_SERVER(user))
|
||||
{
|
||||
ServerInstance->Logs.Debug("USERS", "BUG: Tried to quit server user: " + user->nick);
|
||||
ServerInstance->Logs.Debug("USERS", "BUG: Tried to quit server user: {}", user->nick);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -308,7 +308,7 @@ void UserManager::QuitUser(User* user, const std::string& quitmessage, const std
|
||||
}
|
||||
|
||||
if (!clientlist.erase(user->nick))
|
||||
ServerInstance->Logs.Debug("USERS", "BUG: Nick not found in clientlist, cannot remove: " + user->nick);
|
||||
ServerInstance->Logs.Debug("USERS", "BUG: Nick not found in clientlist, cannot remove: {}", user->nick);
|
||||
|
||||
uuidlist.erase(user->uuid);
|
||||
user->PurgeEmptyChannels();
|
||||
|
@ -483,7 +483,7 @@ void LocalUser::FullConnect()
|
||||
ServerInstance->SNO.WriteToSnoMask('c', "Client connecting on port {} (class {}): {} ({}) [{}\x0F]",
|
||||
server_sa.port(), GetClass()->GetName(), GetRealMask(), GetAddress(), GetRealName());
|
||||
|
||||
ServerInstance->Logs.Debug("BANCACHE", "Adding NEGATIVE hit for " + this->GetAddress());
|
||||
ServerInstance->Logs.Debug("BANCACHE", "Adding NEGATIVE hit for {}", this->GetAddress());
|
||||
ServerInstance->BanCache.AddHit(this->GetAddress(), "", "");
|
||||
// reset the flood penalty (which could have been raised due to things like auto +x)
|
||||
CommandFloodPenalty = 0;
|
||||
@ -504,7 +504,7 @@ bool User::ChangeNick(const std::string& newnick, time_t newts)
|
||||
{
|
||||
if (quitting)
|
||||
{
|
||||
ServerInstance->Logs.Debug("USERS", "BUG: Attempted to change nick of a quitting user: " + this->nick);
|
||||
ServerInstance->Logs.Debug("USERS", "BUG: Attempted to change nick of a quitting user: {}", this->nick);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -577,7 +577,7 @@ void XLine::DefaultApply(User* u, bool bancache)
|
||||
|
||||
if (bancache)
|
||||
{
|
||||
ServerInstance->Logs.Debug("BANCACHE", "Adding positive hit (" + type + ") for " + u->GetAddress());
|
||||
ServerInstance->Logs.Debug("BANCACHE", "Adding positive hit ({}) for {}", type, u->GetAddress());
|
||||
ServerInstance->BanCache.AddHit(u->GetAddress(), this->type, banreason, (this->duration > 0 ? (this->expiry - ServerInstance->Time()) : 0));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user