diff options
92 files changed, 381 insertions, 383 deletions
diff --git a/include/modules.h b/include/modules.h index 88a227534..b081bcacf 100644 --- a/include/modules.h +++ b/include/modules.h @@ -142,7 +142,7 @@ public: } \ catch (CoreException& modexcept) \ { \ - ServerInstance->Logs.Log("MODULE", LOG_DEFAULT, "Exception caught: " + modexcept.GetReason()); \ + ServerInstance->Logs.Normal("MODULE", "Exception caught: " + modexcept.GetReason()); \ } \ } \ } while (0) @@ -168,7 +168,7 @@ do { \ } \ catch (CoreException& except_ ## n) \ { \ - ServerInstance->Logs.Log("MODULE", LOG_DEFAULT, "Exception caught: " + (except_ ## n).GetReason()); \ + ServerInstance->Logs.Normal("MODULE", "Exception caught: " + (except_ ## n).GetReason()); \ } \ } \ } while(0) diff --git a/src/bancache.cpp b/src/bancache.cpp index 8755c1101..db11840ef 100644 --- a/src/bancache.cpp +++ b/src/bancache.cpp @@ -59,7 +59,7 @@ bool BanCacheManager::RemoveIfExpired(BanCacheHash::iterator& it) if (ServerInstance->Time() < it->second->Expiry) return false; - ServerInstance->Logs.Log("BANCACHE", LOG_DEBUG, "Hit on " + it->first + " is out of date, removing!"); + ServerInstance->Logs.Debug("BANCACHE", "Hit on " + it->first + " is out of date, removing!"); delete it->second; it = BanHash.erase(it); return true; @@ -68,9 +68,9 @@ bool BanCacheManager::RemoveIfExpired(BanCacheHash::iterator& it) void BanCacheManager::RemoveEntries(const std::string& type, bool positive) { if (positive) - ServerInstance->Logs.Log("BANCACHE", LOG_DEBUG, "BanCacheManager::RemoveEntries(): Removing positive hits for " + type); + ServerInstance->Logs.Debug("BANCACHE", "BanCacheManager::RemoveEntries(): Removing positive hits for " + type); else - ServerInstance->Logs.Log("BANCACHE", LOG_DEBUG, "BanCacheManager::RemoveEntries(): Removing all negative hits"); + ServerInstance->Logs.Debug("BANCACHE", "BanCacheManager::RemoveEntries(): Removing all negative hits"); for (BanCacheHash::iterator i = BanHash.begin(); i != BanHash.end(); ) { @@ -94,7 +94,7 @@ void BanCacheManager::RemoveEntries(const std::string& type, bool positive) if (remove) { /* we need to remove this one. */ - ServerInstance->Logs.Log("BANCACHE", LOG_DEBUG, "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); } diff --git a/src/base.cpp b/src/base.cpp index 46cabef21..1c1d34364 100644 --- a/src/base.cpp +++ b/src/base.cpp @@ -51,14 +51,14 @@ refcountbase::refcountbase() refcountbase::~refcountbase() { if (refcount && ServerInstance) - ServerInstance->Logs.Log("CULLLIST", LOG_DEBUG, "refcountbase::~ @%p with refcount %d", + ServerInstance->Logs.Debug("CULLLIST", "refcountbase::~ @%p with refcount %d", static_cast<void*>(this), refcount); } usecountbase::~usecountbase() { if (usecount && ServerInstance) - ServerInstance->Logs.Log("CULLLIST", LOG_DEBUG, "usecountbase::~ @%p with refcount %d", + ServerInstance->Logs.Debug("CULLLIST", "usecountbase::~ @%p with refcount %d", static_cast<void*>(this), usecount); } diff --git a/src/channels.cpp b/src/channels.cpp index e79a7715e..78fab90f2 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -125,7 +125,7 @@ Membership* Channel::GetUser(User* user) void Channel::SetDefaultModes() { - ServerInstance->Logs.Log("CHANNELS", LOG_DEBUG, "SetDefaultModes %s", + ServerInstance->Logs.Debug("CHANNELS", "SetDefaultModes %s", ServerInstance->Config->DefaultModes.c_str()); irc::spacesepstream list(ServerInstance->Config->DefaultModes); std::string modeseq; @@ -167,7 +167,7 @@ Channel* Channel::JoinUser(LocalUser* user, std::string cname, bool override, co { if (user->registered != REG_ALL) { - ServerInstance->Logs.Log("CHANNELS", LOG_DEBUG, "Attempted to join unregistered user " + user->uuid + " to channel " + cname); + ServerInstance->Logs.Debug("CHANNELS", "Attempted to join unregistered user " + user->uuid + " to channel " + cname); return NULL; } @@ -240,7 +240,7 @@ Membership* Channel::ForceJoin(User* user, const std::string* privs, bool bursti { if (IS_SERVER(user)) { - ServerInstance->Logs.Log("CHANNELS", LOG_DEBUG, "Attempted to join server user " + user->uuid + " to channel " + this->name); + ServerInstance->Logs.Debug("CHANNELS", "Attempted to join server user " + user->uuid + " to channel " + this->name); return NULL; } diff --git a/src/commands.cpp b/src/commands.cpp index 4ad6ff2a9..533fa6e5f 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -88,7 +88,7 @@ CmdResult SplitCommand::Handle(User* user, const Params& parameters) return HandleServer(static_cast<FakeUser*>(user), parameters); } - ServerInstance->Logs.Log("COMMAND", LOG_DEFAULT, "Unknown user type %u in command (uuid=%s)!", + ServerInstance->Logs.Normal("COMMAND", "Unknown user type %u in command (uuid=%s)!", static_cast<unsigned int>(user->usertype), user->uuid.c_str()); return CmdResult::INVALID; } diff --git a/src/configparser.cpp b/src/configparser.cpp index d7c0f54ca..23995d825 100644 --- a/src/configparser.cpp +++ b/src/configparser.cpp @@ -418,9 +418,7 @@ void ParseStack::DoInclude(std::shared_ptr<ConfigTag> tag, int flags) FilePtr ParseStack::DoOpenFile(const std::string& name, bool isexec) { - ServerInstance->Logs.Log("CONFIG", LOG_DEBUG, "Opening %s: %s", - isexec ? "file" : "executable", name.c_str()); - + ServerInstance->Logs.Debug("CONFIG", "Opening %s: %s", isexec ? "file" : "executable", name.c_str()); if (isexec) return FilePtr(popen(name.c_str(), "r"), pclose); else @@ -532,7 +530,7 @@ bool ConfigTag::readString(const std::string& key, std::string& value, bool allo value = ivalue; if (!allow_lf && (value.find('\n') != std::string::npos)) { - ServerInstance->Logs.Log("CONFIG", LOG_DEFAULT, "Value of <" + name + ":" + key + "> at " + source.str() + + ServerInstance->Logs.Normal("CONFIG", "Value of <" + name + ":" + key + "> at " + source.str() + " contains a linefeed, and linefeeds in this value are not permitted -- stripped to spaces."); for (auto& chr : value) @@ -554,7 +552,7 @@ std::string ConfigTag::getString(const std::string& key, const std::string& def, if (!validator(res)) { - ServerInstance->Logs.Log("CONFIG", LOG_DEFAULT, "WARNING: The value of <%s:%s> is not valid; value set to %s.", + ServerInstance->Logs.Normal("CONFIG", "WARNING: The value of <%s:%s> is not valid; value set to %s.", name.c_str(), key.c_str(), def.c_str()); return def; } @@ -569,7 +567,7 @@ std::string ConfigTag::getString(const std::string& key, const std::string& def, if (res.length() < minlen || res.length() > maxlen) { - ServerInstance->Logs.Log("CONFIG", LOG_DEFAULT, "WARNING: The length of <%s:%s> is not between %ld and %ld; value set to %s.", + ServerInstance->Logs.Normal("CONFIG", "WARNING: The length of <%s:%s> is not between %ld and %ld; value set to %s.", name.c_str(), key.c_str(), minlen, maxlen, def.c_str()); return def; } @@ -612,7 +610,7 @@ namespace const std::string message = "WARNING: <" + tag + ":" + key + "> value of " + val + " contains an invalid magnitude specifier '" + tail + "'; value set to " + ConvToStr(def) + "."; - ServerInstance->Logs.Log("CONFIG", LOG_DEFAULT, message); + ServerInstance->Logs.Normal("CONFIG", message); num = def; } @@ -633,7 +631,7 @@ namespace const std::string message = "WARNING: <" + tag + ":" + key + "> value of " + ConvToStr(num) + " is not between " + ConvToStr(min) + " and " + ConvToStr(max) + "; value set to " + ConvToStr(def) + "."; - ServerInstance->Logs.Log("CONFIG", LOG_DEFAULT, message); + ServerInstance->Logs.Normal("CONFIG", message); num = def; } } @@ -681,7 +679,7 @@ unsigned long ConfigTag::getDuration(const std::string& key, unsigned long def, unsigned long ret; if (!InspIRCd::Duration(duration, ret)) { - ServerInstance->Logs.Log("CONFIG", LOG_DEFAULT, "Value of <" + name + ":" + key + "> at " + source.str() + + ServerInstance->Logs.Normal("CONFIG", "Value of <" + name + ":" + key + "> at " + source.str() + " is not a duration; value set to " + ConvToStr(def) + "."); return def; } @@ -713,7 +711,7 @@ bool ConfigTag::getBool(const std::string& key, bool def) const if (stdalgo::string::equalsci(result, "no") || stdalgo::string::equalsci(result, "false") || stdalgo::string::equalsci(result, "off")) return false; - ServerInstance->Logs.Log("CONFIG", LOG_DEFAULT, "Value of <" + name + ":" + key + "> at " + source.str() + + ServerInstance->Logs.Normal("CONFIG", "Value of <" + name + ":" + key + "> at " + source.str() + " is not valid, ignoring"); return def; } diff --git a/src/configreader.cpp b/src/configreader.cpp index d5b7364ef..f4061861e 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -471,7 +471,7 @@ void ServerConfig::Apply(ServerConfig* old, const std::string &useruid) if (!valid) { - ServerInstance->Logs.Log("CONFIG", LOG_DEFAULT, "There were errors in your configuration file:"); + ServerInstance->Logs.Normal("CONFIG", "There were errors in your configuration file:"); Classes.clear(); } @@ -589,7 +589,7 @@ std::shared_ptr<ConfigTag> ServerConfig::ConfValue(const std::string& tag, std:: if (tags.count() > 1) { - ServerInstance->Logs.Log("CONFIG", LOG_DEFAULT, "Multiple (%zu) <%s> tags found; only the first will be used (first at %s, last at %s)", + ServerInstance->Logs.Normal("CONFIG", "Multiple (%zu) <%s> tags found; only the first will be used (first at %s, last at %s)", tags.count(), tag.c_str(), tags.begin()->second->source.str().c_str(), std::prev(tags.end())->second->source.str().c_str()); } return tags.begin()->second; @@ -633,7 +633,7 @@ void ConfigReaderThread::OnStart() void ConfigReaderThread::OnStop() { ServerConfig* old = ServerInstance->Config; - ServerInstance->Logs.Log("CONFIG", LOG_DEBUG, "Switching to new configuration..."); + ServerInstance->Logs.Debug("CONFIG", "Switching to new configuration..."); ServerInstance->Config = this->Config; Config->Apply(old, UUID); @@ -656,12 +656,12 @@ void ConfigReaderThread::OnStop() { try { - ServerInstance->Logs.Log("MODULE", LOG_DEBUG, "Rehashing " + modname); + ServerInstance->Logs.Debug("MODULE", "Rehashing " + modname); mod->ReadConfig(status); } catch (CoreException& modex) { - ServerInstance->Logs.Log("MODULE", LOG_DEFAULT, "Exception caught: " + modex.GetReason()); + ServerInstance->Logs.Normal("MODULE", "Exception caught: " + modex.GetReason()); if (user) user->WriteNotice(modname + ": " + modex.GetReason()); } diff --git a/src/coremods/core_channel/cmd_kick.cpp b/src/coremods/core_channel/cmd_kick.cpp index 8af8bd73b..67b1f4a02 100644 --- a/src/coremods/core_channel/cmd_kick.cpp +++ b/src/coremods/core_channel/cmd_kick.cpp @@ -90,7 +90,7 @@ 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.Log(MODNAME, LOG_DEBUG, "Dropped KICK due to membership id mismatch: " + ConvToStr(memb->id) + " != " + parameters[2]); + ServerInstance->Logs.Debug(MODNAME, "Dropped KICK due to membership id mismatch: " + ConvToStr(memb->id) + " != " + parameters[2]); return CmdResult::FAILURE; } } diff --git a/src/coremods/core_channel/core_channel.cpp b/src/coremods/core_channel/core_channel.cpp index 3f94caac3..e0c501677 100644 --- a/src/coremods/core_channel/core_channel.cpp +++ b/src/coremods/core_channel/core_channel.cpp @@ -174,7 +174,7 @@ public: const std::string restriction = current.substr(0, pos); const char prefix = current[pos + 1]; - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Exempting prefix %c from %s", prefix, restriction.c_str()); + ServerInstance->Logs.Debug(MODNAME, "Exempting prefix %c from %s", prefix, restriction.c_str()); exempts[restriction] = prefix; } diff --git a/src/coremods/core_channel/invite.cpp b/src/coremods/core_channel/invite.cpp index bee3f80f7..ae6fc3440 100644 --- a/src/coremods/core_channel/invite.cpp +++ b/src/coremods/core_channel/invite.cpp @@ -96,7 +96,7 @@ void Invite::APIImpl::Create(LocalUser* user, Channel* chan, time_t timeout) // Expired, don't bother return; - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Invite::APIImpl::Create(): user=%s chan=%s timeout=%lu", + ServerInstance->Logs.Debug(MODNAME, "Invite::APIImpl::Create(): user=%s chan=%s timeout=%lu", user->uuid.c_str(), chan->name.c_str(), static_cast<unsigned long>(timeout)); Invite* inv = Find(user, chan); @@ -106,7 +106,7 @@ void Invite::APIImpl::Create(LocalUser* user, Channel* chan, time_t timeout) if (!inv->IsTimed()) return; - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Invite::APIImpl::Create(): changing expiration in %p", + ServerInstance->Logs.Debug(MODNAME, "Invite::APIImpl::Create(): changing expiration in %p", static_cast<void*>(inv)); if (timeout == 0) { @@ -131,7 +131,7 @@ void Invite::APIImpl::Create(LocalUser* user, Channel* chan, time_t timeout) userext.Get(user, true)->invites.push_front(inv); chanext.Get(chan, true)->invites.push_front(inv); - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Invite::APIImpl::Create(): created new Invite %p", + ServerInstance->Logs.Debug(MODNAME, "Invite::APIImpl::Create(): created new Invite %p", static_cast<void*>(inv)); } } @@ -179,7 +179,7 @@ Invite::Invite::Invite(LocalUser* u, Channel* c) Invite::Invite::~Invite() { delete expiretimer; - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Invite::~ %p", static_cast<void*>(this)); + ServerInstance->Logs.Debug(MODNAME, "Invite::~ %p", static_cast<void*>(this)); } void Invite::Invite::Serialize(bool human, bool show_chans, std::string& out) @@ -205,7 +205,7 @@ InviteExpireTimer::InviteExpireTimer(Invite::Invite* invite, time_t timeout) bool InviteExpireTimer::Tick() { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "InviteExpireTimer::Tick(): expired %p", static_cast<void*>(inv)); + ServerInstance->Logs.Debug(MODNAME, "InviteExpireTimer::Tick(): expired %p", static_cast<void*>(inv)); apiimpl->Destruct(inv); return false; } diff --git a/src/coremods/core_dns.cpp b/src/coremods/core_dns.cpp index 752766a76..900293d39 100644 --- a/src/coremods/core_dns.cpp +++ b/src/coremods/core_dns.cpp @@ -53,7 +53,7 @@ private: if (pos + name.length() + 2 > output_size) throw Exception(creator, "Unable to pack name"); - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Packing name " + name); + ServerInstance->Logs.Debug(MODNAME, "Packing name " + name); irc::sepstream sep(name, '.'); std::string token; @@ -124,7 +124,7 @@ private: if (name.empty()) throw Exception(creator, "Unable to unpack name - no name"); - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Unpack name " + name); + ServerInstance->Logs.Debug(MODNAME, "Unpack name " + name); return name; } @@ -251,7 +251,7 @@ private: } if (!record.name.empty() && !record.rdata.empty()) - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, record.name + " -> " + record.rdata); + ServerInstance->Logs.Debug(MODNAME, record.name + " -> " + record.rdata); return record; } @@ -297,7 +297,7 @@ public: unsigned short arcount = (input[packet_pos] << 8) | input[packet_pos + 1]; packet_pos += 2; - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "qdcount: " + ConvToStr(qdcount) + " ancount: " + ConvToStr(ancount) + " nscount: " + ConvToStr(nscount) + " arcount: " + ConvToStr(arcount)); + ServerInstance->Logs.Debug(MODNAME, "qdcount: " + ConvToStr(qdcount) + " ancount: " + ConvToStr(ancount) + " nscount: " + ConvToStr(nscount) + " arcount: " + ConvToStr(arcount)); if (qdcount != 1) throw Exception(creator, "Question count != 1 in incoming packet"); @@ -406,7 +406,7 @@ class MyManager final */ bool CheckCache(DNS::Request* req, const DNS::Question& question) { - ServerInstance->Logs.Log(MODNAME, LOG_SPARSE, "cache: Checking cache for " + question.name); + ServerInstance->Logs.Error(MODNAME, "cache: Checking cache for " + question.name); cache_map::iterator it = this->cache.find(question); if (it == this->cache.end()) @@ -419,7 +419,7 @@ class MyManager final return false; } - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "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; @@ -445,7 +445,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.Log(MODNAME, LOG_DEBUG, "cache: added cache for " + rr.name + " -> " + rr.rdata + " ttl: " + ConvToStr(rr.ttl)); + ServerInstance->Logs.Debug(MODNAME, "cache: added cache for " + rr.name + " -> " + rr.rdata + " ttl: " + ConvToStr(rr.ttl)); this->cache[r.question] = r; } @@ -510,7 +510,7 @@ public: return; } - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "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 " + req->question.name + " of type " + ConvToStr(req->question.type) + " to " + this->myserver.addr()); /* Create an id */ unsigned int tries = 0; @@ -557,7 +557,7 @@ public: */ if (req->use_cache && this->CheckCache(req, p.question)) { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Using cached result"); + ServerInstance->Logs.Debug(MODNAME, "Using cached result"); delete req; return; } @@ -631,7 +631,7 @@ public: void OnEventHandlerError(int errcode) override { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "UDP socket got an error event"); + ServerInstance->Logs.Debug(MODNAME, "UDP socket got an error event"); } void OnEventHandlerRead() override @@ -649,7 +649,7 @@ public: { std::string server1 = from.str(); std::string server2 = myserver.str(); - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Got a result from the wrong server! Bad NAT or DNS forging attempt? '%s' != '%s'", + ServerInstance->Logs.Debug(MODNAME, "Got a result from the wrong server! Bad NAT or DNS forging attempt? '%s' != '%s'", server1.c_str(), server2.c_str()); return; } @@ -664,21 +664,21 @@ public: } catch (const Exception& ex) { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, ex.GetReason()); + ServerInstance->Logs.Debug(MODNAME, ex.GetReason()); } // recv_packet.id must be filled in here DNS::Request* request = this->requests[recv_packet.id]; if (!request) { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Received an answer for something we didn't request"); + ServerInstance->Logs.Debug(MODNAME, "Received an answer for something we didn't request"); return; } if (request->question != recv_packet.question) { // This can happen under high latency, drop it silently, do not fail the request - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Received an answer that isn't for a question we asked"); + ServerInstance->Logs.Debug(MODNAME, "Received an answer that isn't for a question we asked"); return; } @@ -690,7 +690,7 @@ public: } else if (recv_packet.flags & QUERYFLAGS_OPCODE) { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Received a nonstandard query"); + ServerInstance->Logs.Debug(MODNAME, "Received a nonstandard query"); this->stats_failure++; recv_packet.error = ERROR_NONSTANDARD_QUERY; request->OnError(&recv_packet); @@ -702,23 +702,23 @@ public: switch (recv_packet.flags & QUERYFLAGS_RCODE) { case 1: - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "format error"); + ServerInstance->Logs.Debug(MODNAME, "format error"); error = ERROR_FORMAT_ERROR; break; case 2: - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "server error"); + ServerInstance->Logs.Debug(MODNAME, "server error"); error = ERROR_SERVER_FAILURE; break; case 3: - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "domain not found"); + ServerInstance->Logs.Debug(MODNAME, "domain not found"); error = ERROR_DOMAIN_NOT_FOUND; break; case 4: - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "not implemented"); + ServerInstance->Logs.Debug(MODNAME, "not implemented"); error = ERROR_NOT_IMPLEMENTED; break; case 5: - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "refused"); + ServerInstance->Logs.Debug(MODNAME, "refused"); error = ERROR_REFUSED; break; default: @@ -731,14 +731,14 @@ public: } else if (recv_packet.answers.empty()) { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "No resource records returned"); + ServerInstance->Logs.Debug(MODNAME, "No resource records returned"); this->stats_failure++; recv_packet.error = ERROR_NO_RECORDS; request->OnError(&recv_packet); } else { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "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); @@ -766,7 +766,7 @@ public: } if (expired) - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "cache: purged %lu expired DNS entries", expired); + ServerInstance->Logs.Debug(MODNAME, "cache: purged %lu expired DNS entries", expired); return true; } @@ -800,23 +800,23 @@ public: if (SocketEngine::Bind(this->GetFd(), bindto) < 0) { /* Failed to bind */ - ServerInstance->Logs.Log(MODNAME, LOG_SPARSE, "Error binding dns socket - hostnames will NOT resolve"); + ServerInstance->Logs.Error(MODNAME, "Error binding dns socket - hostnames will NOT resolve"); SocketEngine::Close(this->GetFd()); this->SetFd(-1); } else if (!SocketEngine::AddFd(this, FD_WANT_POLL_READ | FD_WANT_NO_WRITE)) { - ServerInstance->Logs.Log(MODNAME, LOG_SPARSE, "Internal error starting DNS - hostnames will NOT resolve."); + ServerInstance->Logs.Error(MODNAME, "Internal error starting DNS - hostnames will NOT resolve."); SocketEngine::Close(this->GetFd()); this->SetFd(-1); } if (bindto.family() != myserver.family()) - ServerInstance->Logs.Log(MODNAME, LOG_SPARSE, "Nameserver address family differs from source address family - hostnames might not resolve"); + ServerInstance->Logs.Error(MODNAME, "Nameserver address family differs from source address family - hostnames might not resolve"); } else { - ServerInstance->Logs.Log(MODNAME, LOG_SPARSE, "Error creating DNS socket - hostnames will NOT resolve"); + ServerInstance->Logs.Error(MODNAME, "Error creating DNS socket - hostnames will NOT resolve"); } } }; @@ -834,7 +834,7 @@ class ModuleDNS final { #ifdef _WIN32 // attempt to look up their nameserver from the system - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "WARNING: <dns:server> not defined, attempting to find a working server in the system settings..."); + ServerInstance->Logs.Normal(MODNAME, "WARNING: <dns:server> not defined, attempting to find a working server in the system settings..."); PFIXED_INFO pFixedInfo; DWORD dwBufferSize = sizeof(FIXED_INFO); @@ -858,15 +858,15 @@ class ModuleDNS final if (!DNSServer.empty()) { - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "<dns:server> set to '%s' as first active resolver in the system settings.", DNSServer.c_str()); + ServerInstance->Logs.Normal(MODNAME, "<dns:server> set to '%s' as first active resolver in the system settings.", DNSServer.c_str()); return; } } - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "No viable nameserver found! Defaulting to nameserver '127.0.0.1'!"); + ServerInstance->Logs.Normal(MODNAME, "No viable nameserver found! Defaulting to nameserver '127.0.0.1'!"); #else // attempt to look up their nameserver from /etc/resolv.conf - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "WARNING: <dns:server> not defined, attempting to find working server in /etc/resolv.conf..."); + ServerInstance->Logs.Normal(MODNAME, "WARNING: <dns:server> not defined, attempting to find working server in /etc/resolv.conf..."); std::ifstream resolv("/etc/resolv.conf"); @@ -877,13 +877,13 @@ class ModuleDNS final resolv >> DNSServer; if (DNSServer.find_first_not_of("0123456789.") == std::string::npos || DNSServer.find_first_not_of("0123456789ABCDEFabcdef:") == std::string::npos) { - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "<dns:server> set to '%s' as first resolver in /etc/resolv.conf.",DNSServer.c_str()); + ServerInstance->Logs.Normal(MODNAME, "<dns:server> set to '%s' as first resolver in /etc/resolv.conf.",DNSServer.c_str()); return; } } } - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "/etc/resolv.conf contains no viable nameserver entries! Defaulting to nameserver '127.0.0.1'!"); + ServerInstance->Logs.Normal(MODNAME, "/etc/resolv.conf contains no viable nameserver entries! Defaulting to nameserver '127.0.0.1'!"); #endif DNSServer = "127.0.0.1"; } diff --git a/src/coremods/core_hostname_lookup.cpp b/src/coremods/core_hostname_lookup.cpp index d66338baf..332253528 100644 --- a/src/coremods/core_hostname_lookup.cpp +++ b/src/coremods/core_hostname_lookup.cpp @@ -62,7 +62,7 @@ protected: /** Logs the result of a DNS lookup. */ inline void LogLookup(const DNS::ResourceRecord& rr, bool cached) const { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "DNS %s result for %s: '%s' -> '%s'%s", + ServerInstance->Logs.Debug(MODNAME, "DNS %s result for %s: '%s' -> '%s'%s", manager->GetTypeStr(question.type).c_str(), uuid.c_str(), rr.name.c_str(), rr.rdata.c_str(), cached ? " (cached)" : ""); } @@ -187,7 +187,7 @@ public: catch (const DNS::Exception& e) { delete res_forward; - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "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.Log(MODNAME, LOG_DEBUG, "Error in resolver: " + e.GetReason()); + ServerInstance->Logs.Debug(MODNAME, "Error in resolver: " + e.GetReason()); } } diff --git a/src/coremods/core_oper/cmd_die.cpp b/src/coremods/core_oper/cmd_die.cpp index d5b710f96..d33f25c33 100644 --- a/src/coremods/core_oper/cmd_die.cpp +++ b/src/coremods/core_oper/cmd_die.cpp @@ -60,13 +60,13 @@ CmdResult CommandDie::Handle(User* user, const Params& parameters) if (irc::equals(parameters[0], ServerInstance->Config->ServerName)) { const std::string diebuf = "*** DIE command from " + user->GetFullHost() + ". Terminating."; - ServerInstance->Logs.Log(MODNAME, LOG_SPARSE, diebuf); + ServerInstance->Logs.Error(MODNAME, diebuf); DieRestart::SendError(diebuf); ServerInstance->Exit(EXIT_STATUS_DIE); } else { - ServerInstance->Logs.Log(MODNAME, LOG_SPARSE, "Failed /DIE command from %s", user->GetFullRealHost().c_str()); + ServerInstance->Logs.Error(MODNAME, "Failed /DIE command from %s", user->GetFullRealHost().c_str()); ServerInstance->SNO.WriteGlobalSno('a', "Failed DIE command from %s.", user->GetFullRealHost().c_str()); return CmdResult::FAILURE; } diff --git a/src/coremods/core_oper/cmd_restart.cpp b/src/coremods/core_oper/cmd_restart.cpp index f0384f53d..1769ba61f 100644 --- a/src/coremods/core_oper/cmd_restart.cpp +++ b/src/coremods/core_oper/cmd_restart.cpp @@ -43,7 +43,7 @@ CommandRestart::CommandRestart(Module* parent) CmdResult CommandRestart::Handle(User* user, const Params& parameters) { - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Restart: %s", user->nick.c_str()); + ServerInstance->Logs.Normal(MODNAME, "Restart: %s", user->nick.c_str()); if (irc::equals(parameters[0], ServerInstance->Config->ServerName)) { ServerInstance->SNO.WriteGlobalSno('a', "RESTART command from %s, restarting server.", user->GetFullRealHost().c_str()); diff --git a/src/coremods/core_reloadmodule.cpp b/src/coremods/core_reloadmodule.cpp index 481e5af4c..e9a5d5586 100644 --- a/src/coremods/core_reloadmodule.cpp +++ b/src/coremods/core_reloadmodule.cpp @@ -459,14 +459,14 @@ void DataKeeper::RestoreMemberData(Channel* chan, const std::vector<ChanData::Me User* const user = ServerInstance->Users.FindUUID(md.owner); if (!user) { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "User %s is gone (while processing %s)", md.owner.c_str(), chan->name.c_str()); + ServerInstance->Logs.Debug(MODNAME, "User %s is gone (while processing %s)", md.owner.c_str(), chan->name.c_str()); continue; } Membership* const memb = chan->GetUser(user); if (!memb) { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Member %s is no longer on channel %s", md.owner.c_str(), chan->name.c_str()); + ServerInstance->Logs.Debug(MODNAME, "Member %s is no longer on channel %s", md.owner.c_str(), chan->name.c_str()); continue; } @@ -501,16 +501,16 @@ void DataKeeper::Save(Module* currmod) reloadevprov->Call(&ReloadModule::EventListener::OnReloadModuleSave, mod, this->moddata); - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Saved data about %zu users %zu chans %zu modules", userdatalist.size(), chandatalist.size(), moddata.list.size()); + ServerInstance->Logs.Debug(MODNAME, "Saved data about %zu users %zu chans %zu modules", userdatalist.size(), chandatalist.size(), moddata.list.size()); } void DataKeeper::VerifyServiceProvider(const ProviderInfo& service, const char* type) { const ServiceProvider* sp = service.extitem; if (!sp) - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "%s \"%s\" is no longer available", type, service.itemname.c_str()); + ServerInstance->Logs.Debug(MODNAME, "%s \"%s\" is no longer available", type, service.itemname.c_str()); else if (sp->creator != mod) - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "%s \"%s\" is now handled by %s", type, service.itemname.c_str(), (sp->creator ? sp->creator->ModuleSourceFile.c_str() : "<core>")); + ServerInstance->Logs.Debug(MODNAME, "%s \"%s\" is now handled by %s", type, service.itemname.c_str(), (sp->creator ? sp->creator->ModuleSourceFile.c_str() : "<core>")); } void DataKeeper::LinkModes(ModeType modetype) @@ -555,14 +555,14 @@ void DataKeeper::Restore(Module* newmod) DoRestoreChans(); DoRestoreModules(); - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Restore finished"); + ServerInstance->Logs.Debug(MODNAME, "Restore finished"); } void DataKeeper::Fail() { this->mod = NULL; - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Restore failed, notifying modules"); + ServerInstance->Logs.Debug(MODNAME, "Restore failed, notifying modules"); DoRestoreModules(); } @@ -610,7 +610,7 @@ bool DataKeeper::RestoreSerializer(size_t serializerindex, User* user) void DataKeeper::DoRestoreUsers() { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Restoring user data"); + ServerInstance->Logs.Debug(MODNAME, "Restoring user data"); Modes::ChangeList modechange; for (const auto& userdata : userdatalist) @@ -618,7 +618,7 @@ void DataKeeper::DoRestoreUsers() User* const user = ServerInstance->Users.FindUUID(userdata.owner); if (!user) { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "User %s is gone", userdata.owner.c_str()); + ServerInstance->Logs.Debug(MODNAME, "User %s is gone", userdata.owner.c_str()); continue; } @@ -634,7 +634,7 @@ void DataKeeper::DoRestoreUsers() void DataKeeper::DoRestoreChans() { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Restoring channel data"); + ServerInstance->Logs.Debug(MODNAME, "Restoring channel data"); Modes::ChangeList modechange; for (const auto& chandata : chandatalist) @@ -642,7 +642,7 @@ void DataKeeper::DoRestoreChans() Channel* const chan = ServerInstance->Channels.Find(chandata.owner); if (!chan) { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Channel %s not found", chandata.owner.c_str()); + ServerInstance->Logs.Debug(MODNAME, "Channel %s not found", chandata.owner.c_str()); continue; } @@ -662,7 +662,7 @@ void DataKeeper::DoRestoreModules() { for (const auto& data : moddata.list) { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Calling module data handler %p", static_cast<void*>(data.handler)); + ServerInstance->Logs.Debug(MODNAME, "Calling module data handler %p", static_cast<void*>(data.handler)); data.handler->OnReloadModuleRestore(mod, data.data); } } diff --git a/src/coremods/core_serialize_rfc.cpp b/src/coremods/core_serialize_rfc.cpp index 9aa38723b..f57e1cd4b 100644 --- a/src/coremods/core_serialize_rfc.cpp +++ b/src/coremods/core_serialize_rfc.cpp @@ -65,7 +65,7 @@ bool RFCSerializer::Parse(LocalUser* user, const std::string& line, ClientProtoc maxline += MAX_CLIENT_MESSAGE_TAG_LENGTH + 1; irc::tokenstream tokens(line, start, maxline); - ServerInstance->Logs.Log("USERINPUT", LOG_RAWIO, "C[%s] I %s", user->uuid.c_str(), tokens.GetMessage().c_str()); + ServerInstance->Logs.RawIO("USERINPUT", "C[%s] I %s", user->uuid.c_str(), tokens.GetMessage().c_str()); // This will always exist because of the check at the start of the function. std::string token; diff --git a/src/coremods/core_who.cpp b/src/coremods/core_who.cpp index 429ccedf7..1ecc6102a 100644 --- a/src/coremods/core_who.cpp +++ b/src/coremods/core_who.cpp @@ -141,7 +141,7 @@ private: lastrank = pm->GetPrefixRank(); oplevels[pm->GetModeChar()] = ConvToStr(oplevel); - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Assigned oplevel %u to the %c (%s) prefix mode.", + ServerInstance->Logs.Debug(MODNAME, "Assigned oplevel %u to the %c (%s) prefix mode.", oplevel, pm->GetModeChar(), pm->name.c_str()); } } diff --git a/src/coremods/core_whowas.cpp b/src/coremods/core_whowas.cpp index 3dbb505b5..47623fba6 100644 --- a/src/coremods/core_whowas.cpp +++ b/src/coremods/core_whowas.cpp @@ -378,7 +378,7 @@ void WhoWas::Manager::PurgeNick(WhoWas::Nick* nick) whowas_users::iterator it = whowas.find(nick->nick); if (it == whowas.end()) { - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "ERROR: Inconsistency detected in whowas database, please report"); + ServerInstance->Logs.Normal(MODNAME, "ERROR: Inconsistency detected in whowas database, please report"); return; } PurgeNick(it); diff --git a/src/cull.cpp b/src/cull.cpp index 4c0d2a92b..4990aaf62 100644 --- a/src/cull.cpp +++ b/src/cull.cpp @@ -34,7 +34,7 @@ Cullable::Cullable() #ifdef INSPIRCD_ENABLE_RTTI if (ServerInstance) { - ServerInstance->Logs.Log("CULLLIST", LOG_DEBUG, "Cullable::+%s @%p", + ServerInstance->Logs.Debug("CULLLIST", "Cullable::+%s @%p", typeid(*this).name(), static_cast<void*>(this)); } #endif @@ -45,7 +45,7 @@ Cullable::~Cullable() #ifdef INSPIRCD_ENABLE_RTTI if (ServerInstance) { - ServerInstance->Logs.Log("CULLLIST", LOG_DEBUG, "Cullable::~%s @%p", + ServerInstance->Logs.Debug("CULLLIST", "Cullable::~%s @%p", typeid(*this).name(), static_cast<void*>(this)); } #endif @@ -56,7 +56,7 @@ Cullable::Result Cullable::Cull() #ifdef INSPIRCD_ENABLE_RTTI if (ServerInstance) { - ServerInstance->Logs.Log("CULLLIST", LOG_DEBUG, "Cullable::-%s @%p", + ServerInstance->Logs.Debug("CULLLIST", "Cullable::-%s @%p", typeid(*this).name(), static_cast<void*>(this)); } #endif @@ -86,17 +86,17 @@ void CullList::Apply() if (gone.insert(c).second) { #ifdef INSPIRCD_ENABLE_RTTI - ServerInstance->Logs.Log("CULLLIST", LOG_DEBUG, "Deleting %s @%p", typeid(*c).name(), + ServerInstance->Logs.Debug("CULLLIST", "Deleting %s @%p", typeid(*c).name(), static_cast<void*>(c)); #else - ServerInstance->Logs.Log("CULLLIST", LOG_DEBUG, "Deleting @%p", static_cast<void*>(c)); + ServerInstance->Logs.Debug("CULLLIST", "Deleting @%p", static_cast<void*>(c)); #endif c->Cull(); queue.push_back(c); } else { - ServerInstance->Logs.Log("CULLLIST", LOG_DEBUG, "WARNING: Object @%p culled twice!", + ServerInstance->Logs.Debug("CULLLIST", "WARNING: Object @%p culled twice!", static_cast<void*>(c)); } } @@ -108,7 +108,7 @@ void CullList::Apply() } if (!list.empty()) { - ServerInstance->Logs.Log("CULLLIST", LOG_DEBUG, "WARNING: Objects added to cull list in a destructor"); + ServerInstance->Logs.Debug("CULLLIST", "WARNING: Objects added to cull list in a destructor"); Apply(); } } diff --git a/src/extensible.cpp b/src/extensible.cpp index 0a72cfaca..4b36d0778 100644 --- a/src/extensible.cpp +++ b/src/extensible.cpp @@ -57,7 +57,7 @@ Extensible::~Extensible() { if ((!extensions.empty() || !culled) && ServerInstance) { - ServerInstance->Logs.Log("CULLLIST", LOG_DEBUG, "Extensible destructor called without cull @%p", + ServerInstance->Logs.Debug("CULLLIST", "Extensible destructor called without cull @%p", static_cast<void*>(this)); } } diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 5acf3dabf..817c716ee 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -156,20 +156,20 @@ namespace errno = 0; if (setgroups(0, NULL) == -1) { - ServerInstance->Logs.Log("STARTUP", LOG_DEFAULT, "setgroups() failed (wtf?): %s", strerror(errno)); + ServerInstance->Logs.Normal("STARTUP", "setgroups() failed (wtf?): %s", strerror(errno)); exit(EXIT_STATUS_CONFIG); } struct group* g = getgrnam(SetGroup.c_str()); if (!g) { - ServerInstance->Logs.Log("STARTUP", LOG_DEFAULT, "getgrnam(%s) failed (wrong group?): %s", SetGroup.c_str(), strerror(errno)); + ServerInstance->Logs.Normal("STARTUP", "getgrnam(%s) failed (wrong group?): %s", SetGroup.c_str(), strerror(errno)); exit(EXIT_STATUS_CONFIG); } if (setgid(g->gr_gid) == -1) { - ServerInstance->Logs.Log("STARTUP", LOG_DEFAULT, "setgid(%d) failed (wrong group?): %s", g->gr_gid, strerror(errno)); + ServerInstance->Logs.Normal("STARTUP", "setgid(%d) failed (wrong group?): %s", g->gr_gid, strerror(errno)); exit(EXIT_STATUS_CONFIG); } } @@ -181,13 +181,13 @@ namespace struct passwd* u = getpwnam(SetUser.c_str()); if (!u) { - ServerInstance->Logs.Log("STARTUP", LOG_DEFAULT, "getpwnam(%s) failed (wrong user?): %s", SetUser.c_str(), strerror(errno)); + ServerInstance->Logs.Normal("STARTUP", "getpwnam(%s) failed (wrong user?): %s", SetUser.c_str(), strerror(errno)); exit(EXIT_STATUS_CONFIG); } if (setuid(u->pw_uid) == -1) { - ServerInstance->Logs.Log("STARTUP", LOG_DEFAULT, "setuid(%d) failed (wrong user?): %s", u->pw_uid, strerror(errno)); + ServerInstance->Logs.Normal("STARTUP", "setuid(%d) failed (wrong user?): %s", u->pw_uid, strerror(errno)); exit(EXIT_STATUS_CONFIG); } } @@ -241,7 +241,7 @@ namespace int childpid = fork(); if (childpid < 0) { - ServerInstance->Logs.Log("STARTUP", LOG_DEFAULT, "fork() failed: %s", strerror(errno)); + ServerInstance->Logs.Normal("STARTUP", "fork() failed: %s", strerror(errno)); std::cout << rang::style::bold << rang::fg::red << "Error:" << rang::style::reset << " unable to fork into background: " << strerror(errno); ServerInstance->Exit(EXIT_STATUS_FORK); } @@ -272,13 +272,13 @@ namespace rlimit rl; if (getrlimit(RLIMIT_CORE, &rl) == -1) { - ServerInstance->Logs.Log("STARTUP", LOG_DEFAULT, "Unable to increase core dump size: getrlimit(RLIMIT_CORE) failed: %s", strerror(errno)); + ServerInstance->Logs.Normal("STARTUP", "Unable to increase core dump size: getrlimit(RLIMIT_CORE) failed: %s", strerror(errno)); return; } rl.rlim_cur = rl.rlim_max; if (setrlimit(RLIMIT_CORE, &rl) == -1) - ServerInstance->Logs.Log("STARTUP", LOG_DEFAULT, "Unable to increase core dump size: setrlimit(RLIMIT_CORE) failed: %s", strerror(errno)); + ServerInstance->Logs.Normal("STARTUP", "Unable to increase core dump size: setrlimit(RLIMIT_CORE) failed: %s", strerror(errno)); #endif } @@ -444,7 +444,7 @@ void InspIRCd::WritePID() { if (!ServerInstance->Config->cmdline.writepid) { - this->Logs.Log("STARTUP", LOG_DEFAULT, "--nopid specified on command line; PID file not written."); + this->Logs.Normal("STARTUP", "--nopid specified on command line; PID file not written."); return; } @@ -458,7 +458,7 @@ void InspIRCd::WritePID() else { std::cout << "Failed to write PID-file '" << pidfile << "', exiting." << std::endl; - this->Logs.Log("STARTUP", LOG_DEFAULT, "Failed to write PID-file '%s', exiting.", pidfile.c_str()); + this->Logs.Normal("STARTUP", "Failed to write PID-file '%s', exiting.", pidfile.c_str()); Exit(EXIT_STATUS_PID); } } @@ -506,7 +506,7 @@ InspIRCd::InspIRCd(int argc, char** argv) if (!FindConfigFile(ConfigFileName)) { - this->Logs.Log("STARTUP", LOG_DEFAULT, "Unable to open config file %s", ConfigFileName.c_str()); + this->Logs.Normal("STARTUP", "Unable to open config file %s", ConfigFileName.c_str()); std::cout << "ERROR: Cannot open config file: " << ConfigFileName << std::endl << "Exiting..." << std::endl; Exit(EXIT_STATUS_CONFIG); } @@ -574,7 +574,7 @@ InspIRCd::InspIRCd(int argc, char** argv) if (kill(getppid(), SIGTERM) == -1) { std::cout << "Error killing parent process: " << strerror(errno) << std::endl; - Logs.Log("STARTUP", LOG_DEFAULT, "Error killing parent process: %s",strerror(errno)); + Logs.Normal("STARTUP", "Error killing parent process: %s",strerror(errno)); } } @@ -597,16 +597,16 @@ InspIRCd::InspIRCd(int argc, char** argv) fclose(stdout); if (dup2(fd, STDIN_FILENO) < 0) - Logs.Log("STARTUP", LOG_DEFAULT, "Failed to dup /dev/null to stdin."); + Logs.Normal("STARTUP", "Failed to dup /dev/null to stdin."); if (dup2(fd, STDOUT_FILENO) < 0) - Logs.Log("STARTUP", LOG_DEFAULT, "Failed to dup /dev/null to stdout."); + Logs.Normal("STARTUP", "Failed to dup /dev/null to stdout."); if (dup2(fd, STDERR_FILENO) < 0) - Logs.Log("STARTUP", LOG_DEFAULT, "Failed to dup /dev/null to stderr."); + Logs.Normal("STARTUP", "Failed to dup /dev/null to stderr."); close(fd); } else { - Logs.Log("STARTUP", LOG_DEFAULT, "Keeping pseudo-tty open as we are running in the foreground."); + Logs.Normal("STARTUP", "Keeping pseudo-tty open as we are running in the foreground."); } #else /* Set win32 service as running, if we are running as a service */ @@ -624,7 +624,7 @@ InspIRCd::InspIRCd(int argc, char** argv) WritePID(); DropRoot(); - Logs.Log("STARTUP", LOG_DEFAULT, "Startup complete as '%s'[%s], %lu max open sockets", Config->ServerName.c_str(),Config->GetSID().c_str(), SocketEngine::GetMaxFds()); + Logs.Normal("STARTUP", "Startup complete as '%s'[%s], %lu max open sockets", Config->ServerName.c_str(),Config->GetSID().c_str(), SocketEngine::GetMaxFds()); } void InspIRCd::UpdateTime() @@ -657,7 +657,7 @@ void InspIRCd::Run() if (this->ConfigThread && this->ConfigThread->IsDone()) { /* Rehash has completed */ - this->Logs.Log("CONFIG", LOG_DEBUG, "New configuration has been read, applying..."); + this->Logs.Debug("CONFIG", "New configuration has been read, applying..."); ConfigThread->Stop(); stdalgo::delete_zero(ConfigThread); } diff --git a/src/inspsocket.cpp b/src/inspsocket.cpp index df2cdd6bf..545e569e2 100644 --- a/src/inspsocket.cpp +++ b/src/inspsocket.cpp @@ -96,7 +96,7 @@ BufferedSocketError BufferedSocket::BeginConnect(const irc::sockets::sockaddrs& this->Timeout = new SocketTimeout(this->GetFd(), this, timeout); ServerInstance->Timers.AddTimer(this->Timeout); - ServerInstance->Logs.Log("SOCKET", LOG_DEBUG, "BufferedSocket::DoConnect success"); + ServerInstance->Logs.Debug("SOCKET", "BufferedSocket::DoConnect success"); return I_ERR_NONE; } @@ -227,7 +227,7 @@ void StreamSocket::DoWrite() } if (!error.empty() || !HasFd()) { - ServerInstance->Logs.Log("SOCKET", LOG_DEBUG, "DoWrite on errored or closed socket"); + ServerInstance->Logs.Debug("SOCKET", "DoWrite on errored or closed socket"); return; } @@ -363,7 +363,7 @@ void StreamSocket::WriteData(const std::string &data) { if (!HasFd()) { - ServerInstance->Logs.Log("SOCKET", LOG_DEBUG, "Attempt to write data to dead socket: %s", + ServerInstance->Logs.Debug("SOCKET", "Attempt to write data to dead socket: %s", data.c_str()); return; } @@ -376,7 +376,7 @@ void StreamSocket::WriteData(const std::string &data) bool SocketTimeout::Tick() { - ServerInstance->Logs.Log("SOCKET", LOG_DEBUG, "SocketTimeout::Tick"); + ServerInstance->Logs.Debug("SOCKET", "SocketTimeout::Tick"); if (SocketEngine::GetRef(this->sfd) != this->sock) { @@ -468,7 +468,7 @@ void StreamSocket::OnEventHandlerRead() } catch (CoreException& ex) { - ServerInstance->Logs.Log("SOCKET", LOG_DEFAULT, "Caught exception in socket processing on FD %d - '%s'", fd, ex.GetReason().c_str()); + ServerInstance->Logs.Normal("SOCKET", "Caught exception in socket processing on FD %d - '%s'", fd, ex.GetReason().c_str()); SetError(ex.GetReason()); } CheckError(I_ERR_OTHER); @@ -487,7 +487,7 @@ void StreamSocket::CheckError(BufferedSocketError errcode) { if (!error.empty()) { - ServerInstance->Logs.Log("SOCKET", LOG_DEBUG, "Error on FD %d - '%s'", fd, error.c_str()); + ServerInstance->Logs.Debug("SOCKET", "Error on FD %d - '%s'", fd, error.c_str()); OnError(errcode); } } diff --git a/src/listensocket.cpp b/src/listensocket.cpp index f52aa2c0d..c58bb3381 100644 --- a/src/listensocket.cpp +++ b/src/listensocket.cpp @@ -136,14 +136,14 @@ ListenSocket::~ListenSocket() { if (this->HasFd()) { - ServerInstance->Logs.Log("SOCKET", LOG_DEBUG, "Shut down listener on fd %d", this->fd); + ServerInstance->Logs.Debug("SOCKET", "Shut down listener on fd %d", this->fd); SocketEngine::Shutdown(this, 2); if (SocketEngine::Close(this) != 0) - ServerInstance->Logs.Log("SOCKET", LOG_DEBUG, "Failed to cancel listener: %s", strerror(errno)); + ServerInstance->Logs.Debug("SOCKET", "Failed to cancel listener: %s", strerror(errno)); if (bind_sa.family() == AF_UNIX && unlink(bind_sa.un.sun_path)) - ServerInstance->Logs.Log("SOCKET", LOG_DEBUG, "Failed to unlink UNIX socket: %s", strerror(errno)); + ServerInstance->Logs.Debug("SOCKET", "Failed to unlink UNIX socket: %s", strerror(errno)); } } @@ -155,7 +155,7 @@ void ListenSocket::OnEventHandlerRead() socklen_t length = sizeof(client); int incomingSockfd = SocketEngine::Accept(this, &client.sa, &length); - ServerInstance->Logs.Log("SOCKET", LOG_DEBUG, "Accepting connection on socket %s fd %d", bind_sa.str().c_str(), incomingSockfd); + ServerInstance->Logs.Debug("SOCKET", "Accepting connection on socket %s fd %d", bind_sa.str().c_str(), incomingSockfd); if (incomingSockfd < 0) { ServerInstance->stats.Refused++; @@ -165,7 +165,7 @@ void ListenSocket::OnEventHandlerRead() socklen_t sz = sizeof(server); if (getsockname(incomingSockfd, &server.sa, &sz)) { - ServerInstance->Logs.Log("SOCKET", LOG_DEBUG, "Can't get peername: %s", strerror(errno)); + ServerInstance->Logs.Debug("SOCKET", "Can't get peername: %s", strerror(errno)); } if (client.family() == AF_INET6) @@ -217,7 +217,7 @@ void ListenSocket::OnEventHandlerRead() } ServerInstance->stats.Refused++; - ServerInstance->Logs.Log("SOCKET", LOG_DEFAULT, "Refusing connection on %s - %s", bind_sa.str().c_str(), + ServerInstance->Logs.Normal("SOCKET", "Refusing connection on %s - %s", bind_sa.str().c_str(), res == MOD_RES_DENY ? "Connection refused by module" : "Module for this port not found"); SocketEngine::Close(incomingSockfd); } diff --git a/src/listmode.cpp b/src/listmode.cpp index 4942742d0..9956ded25 100644 --- a/src/listmode.cpp +++ b/src/listmode.cpp @@ -86,7 +86,7 @@ void ListModeBase::DoRehash() // If no default limit has been specified then insert one. if (!seen_default) { - ServerInstance->Logs.Log("MODE", LOG_DEBUG, "No default <maxlist> entry was found for the %s mode; defaulting to %u", + ServerInstance->Logs.Debug("MODE", "No default <maxlist> entry was found for the %s mode; defaulting to %u", name.c_str(), DEFAULT_LIST_SIZE); newlimits.push_back(ListLimit("*", DEFAULT_LIST_SIZE)); } diff --git a/src/modulemanager.cpp b/src/modulemanager.cpp index 7f177c560..9bb36241a 100644 --- a/src/modulemanager.cpp +++ b/src/modulemanager.cpp @@ -48,14 +48,14 @@ bool ModuleManager::Load(const std::string& modname, bool defer) if (!std::filesystem::is_regular_file(moduleFile, ec)) { LastModuleError = "Module file could not be found: " + filename; - ServerInstance->Logs.Log("MODULE", LOG_DEFAULT, LastModuleError); + ServerInstance->Logs.Normal("MODULE", LastModuleError); return false; } if (Modules.find(filename) != Modules.end()) { LastModuleError = "Module " + filename + " is already loaded, cannot load a module twice!"; - ServerInstance->Logs.Log("MODULE", LOG_DEFAULT, LastModuleError); + ServerInstance->Logs.Normal("MODULE", LastModuleError); return false; } @@ -90,14 +90,14 @@ bool ModuleManager::Load(const std::string& modname, bool defer) if (!version) version = "unknown"; - ServerInstance->Logs.Log("MODULE", LOG_DEFAULT, "New module introduced: %s (version %s, properties %s)", + ServerInstance->Logs.Normal("MODULE", "New module introduced: %s (version %s, properties %s)", filename.c_str(), version, newmod->GetPropertyString().c_str()); } else { LastModuleError = "Unable to load " + filename + ": " + newhandle->LastError(); - ServerInstance->Logs.Log("MODULE", LOG_DEFAULT, LastModuleError); + ServerInstance->Logs.Normal("MODULE", LastModuleError); delete newhandle; return false; } @@ -115,7 +115,7 @@ bool ModuleManager::Load(const std::string& modname, bool defer) else delete newhandle; LastModuleError = "Unable to load " + filename + ": " + modexcept.GetReason(); - ServerInstance->Logs.Log("MODULE", LOG_DEFAULT, LastModuleError); + ServerInstance->Logs.Normal("MODULE", LastModuleError); return false; } @@ -148,7 +148,7 @@ void ModuleManager::LoadCoreModules(std::map<std::string, ServiceList>& servicem if (!Load(name, true)) { - ServerInstance->Logs.Log("MODULE", LOG_DEFAULT, this->LastError()); + ServerInstance->Logs.Normal("MODULE", this->LastError()); std::cout << std::endl << "[" << rang::style::bold << rang::fg::red << "*" << rang::style::reset << "] " << this->LastError() << std::endl << std::endl; ServerInstance->Exit(EXIT_STATUS_MODULE); } diff --git a/src/modules.cpp b/src/modules.cpp index 37cf9954b..1409e793c 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -360,7 +360,7 @@ bool ModuleManager::PrioritizeHooks() break; if (tries == 19) { - ServerInstance->Logs.Log("MODULE", LOG_DEFAULT, "Hook priority dependency loop detected"); + ServerInstance->Logs.Normal("MODULE", "Hook priority dependency loop detected"); return false; } } @@ -374,7 +374,7 @@ bool ModuleManager::CanUnload(Module* mod) if ((modfind == Modules.end()) || (modfind->second != mod) || (mod->dying)) { LastModuleError = "Module " + mod->ModuleSourceFile + " is not loaded, cannot unload it!"; - ServerInstance->Logs.Log("MODULE", LOG_DEFAULT, LastModuleError); + ServerInstance->Logs.Normal("MODULE", LastModuleError); return false; } @@ -451,7 +451,7 @@ void ModuleManager::DoSafeUnload(Module* mod) Modules.erase(modfind); ServerInstance->GlobalCulls.AddItem(mod); - ServerInstance->Logs.Log("MODULE", LOG_DEFAULT, "The %s module was unloaded", mod->ModuleSourceFile.c_str()); + ServerInstance->Logs.Normal("MODULE", "The %s module was unloaded", mod->ModuleSourceFile.c_str()); } void ModuleManager::UnloadAll() @@ -522,7 +522,7 @@ void ModuleManager::LoadAll() std::cout << "[" << rang::style::bold << rang::fg::green << "*" << rang::style::reset << "] Loading module:\t" << rang::style::bold << rang::fg::green << name << rang::style::reset << std::endl; if (!this->Load(name, true)) { - ServerInstance->Logs.Log("MODULE", LOG_DEFAULT, this->LastError()); + ServerInstance->Logs.Normal("MODULE", this->LastError()); std::cout << std::endl << "[" << rang::style::bold << rang::fg::red << "*" << rang::style::reset << "] " << this->LastError() << std::endl << std::endl; ServerInstance->Exit(EXIT_STATUS_MODULE); } @@ -533,7 +533,7 @@ void ModuleManager::LoadAll() { try { - ServerInstance->Logs.Log("MODULE", LOG_DEBUG, "Initializing %s", modname.c_str()); + ServerInstance->Logs.Debug("MODULE", "Initializing %s", modname.c_str()); AttachAll(mod); AddServices(servicemap[modname]); mod->init(); @@ -541,7 +541,7 @@ void ModuleManager::LoadAll() catch (CoreException& modexcept) { LastModuleError = "Unable to initialize " + modname + ": " + modexcept.GetReason(); - ServerInstance->Logs.Log("MODULE", LOG_DEFAULT, LastModuleError); + ServerInstance->Logs.Normal("MODULE", LastModuleError); std::cout << std::endl << "[" << rang::style::bold << rang::fg::red << "*" << rang::style::reset << "] " << LastModuleError << std::endl << std::endl; ServerInstance->Exit(EXIT_STATUS_MODULE); } @@ -557,13 +557,13 @@ void ModuleManager::LoadAll() { try { - ServerInstance->Logs.Log("MODULE", LOG_DEBUG, "Reading configuration for %s", modname.c_str()); + ServerInstance->Logs.Debug("MODULE", "Reading configuration for %s", modname.c_str()); mod->ReadConfig(confstatus); } catch (CoreException& modexcept) { LastModuleError = "Unable to read the configuration for " + modname + ": " + modexcept.GetReason(); - ServerInstance->Logs.Log("MODULE", LOG_DEFAULT, LastModuleError); + ServerInstance->Logs.Normal("MODULE", LastModuleError); std::cout << std::endl << "[" << rang::style::bold << rang::fg::red << "*" << rang::style::reset << "] " << LastModuleError << std::endl << std::endl; ServerInstance->Exit(EXIT_STATUS_CONFIG); } @@ -586,7 +586,7 @@ void ModuleManager::AddServices(const ServiceList& list) void ModuleManager::AddService(ServiceProvider& item) { - ServerInstance->Logs.Log("SERVICE", LOG_DEBUG, "Adding %s %s provided by %s", item.name.c_str(), + ServerInstance->Logs.Debug("SERVICE", "Adding %s %s provided by %s", item.name.c_str(), item.GetTypeString(), item.creator ? item.creator->ModuleSourceFile.c_str() : "the core"); switch (item.service) { @@ -616,7 +616,7 @@ void ModuleManager::AddService(ServiceProvider& item) void ModuleManager::DelService(ServiceProvider& item) { - ServerInstance->Logs.Log("SERVICE", LOG_DEBUG, "Deleting %s %s provided by %s", item.name.c_str(), + ServerInstance->Logs.Debug("SERVICE", "Deleting %s %s provided by %s", item.name.c_str(), item.GetTypeString(), item.creator ? item.creator->ModuleSourceFile.c_str() : "the core"); switch (item.service) { diff --git a/src/modules/extra/m_argon2.cpp b/src/modules/extra/m_argon2.cpp index 3df31664c..c1ee37e6c 100644 --- a/src/modules/extra/m_argon2.cpp +++ b/src/modules/extra/m_argon2.cpp @@ -47,7 +47,7 @@ private: return ARGON2_VERSION_13; } - ServerInstance->Logs.Log("MODULE", LOG_DEFAULT, "Unknown Argon2 version (%lu) specified; assuming 13", + ServerInstance->Logs.Normal("MODULE", "Unknown Argon2 version (%lu) specified; assuming 13", version); return ARGON2_VERSION_13; } diff --git a/src/modules/extra/m_geo_maxmind.cpp b/src/modules/extra/m_geo_maxmind.cpp index 177f95f87..52213ad73 100644 --- a/src/modules/extra/m_geo_maxmind.cpp +++ b/src/modules/extra/m_geo_maxmind.cpp @@ -190,13 +190,13 @@ public: Geolocation::Location* location = iter->second; if (location->GetUseCount()) { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Preserving geolocation data for %s (%s) with use count %u... ", + ServerInstance->Logs.Debug(MODNAME, "Preserving geolocation data for %s (%s) with use count %u... ", location->GetName().c_str(), location->GetCode().c_str(), location->GetUseCount()); iter++; } else { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Deleting unused geolocation data for %s (%s)", + ServerInstance->Logs.Debug(MODNAME, "Deleting unused geolocation data for %s (%s)", location->GetName().c_str(), location->GetCode().c_str()); delete location; iter = geoapi.locations.erase(iter); diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp index d2f3f5c28..34c02fa38 100644 --- a/src/modules/extra/m_mysql.cpp +++ b/src/modules/extra/m_mysql.cpp @@ -328,7 +328,7 @@ public: unsigned int port = static_cast<unsigned int>(config->getUInt("port", 3306, 1, 65535)); if (!mysql_real_connect(connection, host.c_str(), user.c_str(), pass.c_str(), dbname.c_str(), port, NULL, CLIENT_IGNORE_SIGPIPE)) { - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Unable to connect to the %s MySQL server: %s", + ServerInstance->Logs.Normal(MODNAME, "Unable to connect to the %s MySQL server: %s", GetId().c_str(), mysql_error(connection)); return false; } @@ -337,7 +337,7 @@ public: const std::string charset = config->getString("charset"); if (!charset.empty() && mysql_set_character_set(connection, charset.c_str())) { - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Could not set character set for %s to \"%s\": %s", + ServerInstance->Logs.Normal(MODNAME, "Could not set character set for %s to \"%s\": %s", GetId().c_str(), charset.c_str(), mysql_error(connection)); return false; } @@ -346,7 +346,7 @@ public: const std::string initialquery = config->getString("initialquery"); if (!initialquery.empty() && mysql_real_query(connection, initialquery.data(), initialquery.length())) { - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Could not execute initial query \"%s\" for %s: %s", + ServerInstance->Logs.Normal(MODNAME, "Could not execute initial query \"%s\" for %s: %s", initialquery.c_str(), name.c_str(), mysql_error(connection)); return false; } @@ -388,7 +388,7 @@ public: void Submit(SQL::Query* q, const std::string& qs) override { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "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(); diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp index aebf2db8f..86dcfe6ce 100644 --- a/src/modules/extra/m_pgsql.cpp +++ b/src/modules/extra/m_pgsql.cpp @@ -273,7 +273,7 @@ public: bool HandleConnectError(const char* reason) { - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Could not connect to the \"%s\" database: %s", + ServerInstance->Logs.Normal(MODNAME, "Could not connect to the \"%s\" database: %s", GetId().c_str(), reason); return false; } @@ -419,7 +419,7 @@ restart: void Submit(SQL::Query *req, const std::string& q) override { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Executing PostgreSQL query: " + q); + ServerInstance->Logs.Debug(MODNAME, "Executing PostgreSQL query: " + q); if (qinprog.q.empty()) { DoQuery(QueueItem(req,q)); @@ -448,7 +448,7 @@ restart: int error; size_t escapedsize = PQescapeStringConn(sql, &buffer[0], parm.data(), parm.length(), &error); if (error) - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "BUG: Apparently PQescapeStringConn() failed"); + ServerInstance->Logs.Debug(MODNAME, "BUG: Apparently PQescapeStringConn() failed"); res.append(&buffer[0], escapedsize); } } @@ -479,7 +479,7 @@ restart: int error; size_t escapedsize = PQescapeStringConn(sql, &buffer[0], parm.data(), parm.length(), &error); if (error) - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "BUG: Apparently PQescapeStringConn() failed"); + ServerInstance->Logs.Debug(MODNAME, "BUG: Apparently PQescapeStringConn() failed"); res.append(&buffer[0], escapedsize); } } diff --git a/src/modules/extra/m_sqlite3.cpp b/src/modules/extra/m_sqlite3.cpp index 9459a84cf..a388d3797 100644 --- a/src/modules/extra/m_sqlite3.cpp +++ b/src/modules/extra/m_sqlite3.cpp @@ -111,7 +111,7 @@ public: // Even in case of an error conn must be closed sqlite3_close(conn); conn = NULL; - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "WARNING: Could not open DB with id: " + tag->getString("id")); + ServerInstance->Logs.Normal(MODNAME, "WARNING: Could not open DB with id: " + tag->getString("id")); } } @@ -174,7 +174,7 @@ public: void Submit(SQL::Query* query, const std::string& q) override { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Executing SQLite3 query: " + q); + ServerInstance->Logs.Debug(MODNAME, "Executing SQLite3 query: " + q); Query(query, q); delete query; } diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index f30284e4e..463ecbf03 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -320,7 +320,7 @@ namespace GnuTLS if (gnutls_priority_init(&test, ret.c_str(), NULL) < 0) { // The new token broke the priority string, revert to the previously working one - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Priority string token not recognized: \"%s\"", token.c_str()); + ServerInstance->Logs.Debug(MODNAME, "Priority string token not recognized: \"%s\"", token.c_str()); ret.erase(prevpos); } else @@ -526,12 +526,12 @@ namespace GnuTLS { // Stripping failed, act as if a prio string wasn't set stripped = GnuTLS::Priority::RemoveUnknownTokens(GnuTLS::Priority::GetDefault()); - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Priority string for profile \"%s\" contains unknown tokens and stripping it didn't yield a working one either, falling back to \"%s\"", profilename.c_str(), stripped.c_str()); + ServerInstance->Logs.Normal(MODNAME, "Priority string for profile \"%s\" contains unknown tokens and stripping it didn't yield a working one either, falling back to \"%s\"", profilename.c_str(), stripped.c_str()); } else if ((found) && (stripped != priostr)) { // Prio string was set in the config and we ended up with something that works but different - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Priority string for profile \"%s\" contains unknown tokens, stripped to \"%s\"", profilename.c_str(), stripped.c_str()); + ServerInstance->Logs.Normal(MODNAME, "Priority string for profile \"%s\" contains unknown tokens, stripped to \"%s\"", profilename.c_str(), stripped.c_str()); } priostr.swap(stripped); } @@ -1132,14 +1132,14 @@ class ModuleSSLGnuTLS final { if (!stdalgo::string::equalsci(tag->getString("provider"), "gnutls")) { - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Ignoring non-GnuTLS <sslprofile> tag at " + tag->source.str()); + ServerInstance->Logs.Normal(MODNAME, "Ignoring non-GnuTLS <sslprofile> tag at " + tag->source.str()); continue; } std::string name = tag->getString("name"); if (name.empty()) { - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Ignoring <sslprofile> tag without name at " + tag->source.str()); + ServerInstance->Logs.Normal(MODNAME, "Ignoring <sslprofile> tag without name at " + tag->source.str()); continue; } @@ -1174,7 +1174,7 @@ public: void init() override { - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "GnuTLS lib version %s module was compiled for " GNUTLS_VERSION, gnutls_check_version(NULL)); + ServerInstance->Logs.Normal(MODNAME, "GnuTLS lib version %s module was compiled for " GNUTLS_VERSION, gnutls_check_version(NULL)); ServerInstance->GenRandom = GnuTLS::GenRandom; } diff --git a/src/modules/extra/m_ssl_mbedtls.cpp b/src/modules/extra/m_ssl_mbedtls.cpp index 8e4f01086..09023771b 100644 --- a/src/modules/extra/m_ssl_mbedtls.cpp +++ b/src/modules/extra/m_ssl_mbedtls.cpp @@ -278,7 +278,7 @@ namespace mbedTLS size_t len = strlen(msg); if ((len > 0) && (msg[len-1] == '\n')) len--; - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "%s:%d %.*s", file, line, len, msg); + ServerInstance->Logs.Debug(MODNAME, "%s:%d %.*s", file, line, len, msg); } #endif @@ -890,14 +890,14 @@ private: { if (!stdalgo::string::equalsci(tag->getString("provider"), "mbedtls")) { - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Ignoring non-mbedTLS <sslprofile> tag at " + tag->source.str()); + ServerInstance->Logs.Normal(MODNAME, "Ignoring non-mbedTLS <sslprofile> tag at " + tag->source.str()); continue; } std::string name = tag->getString("name"); if (name.empty()) { - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Ignoring <sslprofile> tag without name at " + tag->source.str()); + ServerInstance->Logs.Normal(MODNAME, "Ignoring <sslprofile> tag without name at " + tag->source.str()); continue; } @@ -934,7 +934,7 @@ public: { char verbuf[16]; // Should be at least 9 bytes in size mbedtls_version_get_string(verbuf); - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "mbedTLS lib version %s module was compiled for " MBEDTLS_VERSION_STRING, verbuf); + ServerInstance->Logs.Normal(MODNAME, "mbedTLS lib version %s module was compiled for " MBEDTLS_VERSION_STRING, verbuf); if (!ctr_drbg.Seed(entropy)) throw ModuleException(this, "CTR DRBG seed failed"); diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index e3b7f350b..5d4876d9e 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -359,9 +359,9 @@ namespace OpenSSL if (!setoptions && !clearoptions) return; // Nothing to do - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Setting %s %s context options, default: %ld set: %ld clear: %ld", name.c_str(), ctxname.c_str(), ctx.GetDefaultContextOptions(), setoptions, clearoptions); + ServerInstance->Logs.Debug(MODNAME, "Setting %s %s context options, default: %ld set: %ld clear: %ld", name.c_str(), ctxname.c_str(), ctx.GetDefaultContextOptions(), setoptions, clearoptions); long final = context.SetRawContextOptions(setoptions, clearoptions); - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "%s %s context options: %ld", name.c_str(), ctxname.c_str(), final); + ServerInstance->Logs.Normal(MODNAME, "%s %s context options: %ld", name.c_str(), ctxname.c_str(), final); } public: @@ -405,7 +405,7 @@ namespace OpenSSL throw Exception("Can't set ciphersuite list to \"" + ciphersuites + "\" " + lasterr); } #else - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "You have configured <sslprofile:ciphersuites> but your version of OpenSSL does not support TLSv1.3+"); + ServerInstance->Logs.Debug(MODNAME, "You have configured <sslprofile:ciphersuites> but your version of OpenSSL does not support TLSv1.3+"); #endif } @@ -440,7 +440,7 @@ namespace OpenSSL if ((!ctx.SetCA(filename)) || (!clientctx.SetCA(filename))) { ERR_print_errors_cb(error_callback, this); - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Can't read CA list from %s. This is only a problem if you want to verify client certificates, otherwise it's safe to ignore this message. Error: %s", filename.c_str(), lasterr.c_str()); + ServerInstance->Logs.Normal(MODNAME, "Can't read CA list from %s. This is only a problem if you want to verify client certificates, otherwise it's safe to ignore this message. Error: %s", filename.c_str(), lasterr.c_str()); } // Load the CRLs. @@ -663,7 +663,7 @@ private: if (status != STATUS_NONE) return true; - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Session %p killed, attempted to renegotiate", (void*)sess); + ServerInstance->Logs.Debug(MODNAME, "Session %p killed, attempted to renegotiate", (void*)sess); CloseSession(); sock->SetError("Renegotiation is not allowed"); return false; @@ -959,14 +959,14 @@ class ModuleSSLOpenSSL final { if (!stdalgo::string::equalsci(tag->getString("provider"), "openssl")) { - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Ignoring non-OpenSSL <sslprofile> tag at " + tag->source.str()); + ServerInstance->Logs.Normal(MODNAME, "Ignoring non-OpenSSL <sslprofile> tag at " + tag->source.str()); continue; } std::string name = tag->getString("name"); if (name.empty()) { - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Ignoring <sslprofile> tag without name at " + tag->source.str()); + ServerInstance->Logs.Normal(MODNAME, "Ignoring <sslprofile> tag without name at " + tag->source.str()); continue; } @@ -1007,7 +1007,7 @@ public: void init() override { - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "OpenSSL lib version \"%s\" module was compiled for \"" OPENSSL_VERSION_TEXT "\"", OpenSSL_version(OPENSSL_VERSION)); + ServerInstance->Logs.Normal(MODNAME, "OpenSSL lib version \"%s\" module was compiled for \"" OPENSSL_VERSION_TEXT "\"", OpenSSL_version(OPENSSL_VERSION)); // Register application specific data char exdatastr[] = "inspircd"; diff --git a/src/modules/extra/m_sslrehashsignal.cpp b/src/modules/extra/m_sslrehashsignal.cpp index 3f90bf86d..41b90d6df 100644 --- a/src/modules/extra/m_sslrehashsignal.cpp +++ b/src/modules/extra/m_sslrehashsignal.cpp @@ -54,7 +54,7 @@ public: const std::string feedbackmsg = "Got SIGUSR1, reloading TLS credentials"; ServerInstance->SNO.WriteGlobalSno('r', feedbackmsg); - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, feedbackmsg); + ServerInstance->Logs.Normal(MODNAME, feedbackmsg); const std::string str = "tls"; FOREACH_MOD(OnModuleRehash, (NULL, str)); diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp index de2cee7bc..951d6d81a 100644 --- a/src/modules/m_callerid.cpp +++ b/src/modules/m_callerid.cpp @@ -145,12 +145,12 @@ struct CallerIDExtInfo final callerid_data* target = this->Get(user, false); if (!target) { - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "ERROR: Inconsistency detected in callerid state, please report (1)"); + ServerInstance->Logs.Normal(MODNAME, "ERROR: Inconsistency detected in callerid state, please report (1)"); continue; // shouldn't happen, but oh well. } if (!stdalgo::vector::swaperase(target->wholistsme, dat)) - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "ERROR: Inconsistency detected in callerid state, please report (2)"); + ServerInstance->Logs.Normal(MODNAME, "ERROR: Inconsistency detected in callerid state, please report (2)"); } delete dat; } @@ -321,12 +321,12 @@ public: if (!dat2) { // How the fuck is this possible. - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "ERROR: Inconsistency detected in callerid state, please report (3)"); + ServerInstance->Logs.Normal(MODNAME, "ERROR: Inconsistency detected in callerid state, please report (3)"); return false; } if (!stdalgo::vector::swaperase(dat2->wholistsme, dat)) - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "ERROR: Inconsistency detected in callerid state, please report (4)"); + ServerInstance->Logs.Normal(MODNAME, "ERROR: Inconsistency detected in callerid state, please report (4)"); user->WriteNotice(whotoremove->nick + " is no longer on your accept list"); return true; @@ -382,7 +382,7 @@ private: { // Find me on their callerid list if (!dat->accepting.erase(who)) - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "ERROR: Inconsistency detected in callerid state, please report (5)"); + ServerInstance->Logs.Normal(MODNAME, "ERROR: Inconsistency detected in callerid state, please report (5)"); } userdata->wholistsme.clear(); diff --git a/src/modules/m_cap.cpp b/src/modules/m_cap.cpp index 07033df2b..06522b315 100644 --- a/src/modules/m_cap.cpp +++ b/src/modules/m_cap.cpp @@ -88,7 +88,7 @@ class Cap::ManagerImpl final void OnReloadModuleSave(Module* mod, ReloadModule::CustomData& cd) override { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "OnReloadModuleSave()"); + ServerInstance->Logs.Debug(MODNAME, "OnReloadModuleSave()"); if (mod == creator) return; @@ -101,7 +101,7 @@ class Cap::ManagerImpl final if (cap->creator != mod) continue; - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Module being reloaded implements cap %s, saving cap users", cap->GetName().c_str()); + ServerInstance->Logs.Debug(MODNAME, "Module being reloaded implements cap %s, saving cap users", cap->GetName().c_str()); capmoddata->caps.emplace_back(cap); CapModData::Data& capdata = capmoddata->caps.back(); @@ -122,7 +122,7 @@ class Cap::ManagerImpl final Capability* cap = ManagerImpl::Find(capdata.name); if (!cap) { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Cap %s is no longer available after reload", capdata.name.c_str()); + ServerInstance->Logs.Debug(MODNAME, "Cap %s is no longer available after reload", capdata.name.c_str()); continue; } @@ -132,7 +132,7 @@ class Cap::ManagerImpl final User* user = ServerInstance->Users.FindUUID(uuid); if (!user) { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "User %s is gone when trying to restore cap %s", uuid.c_str(), capdata.name.c_str()); + ServerInstance->Logs.Debug(MODNAME, "User %s is gone when trying to restore cap %s", uuid.c_str(), capdata.name.c_str()); continue; } @@ -165,7 +165,7 @@ public: if (cap->IsRegistered()) return; - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Registering cap %s", cap->GetName().c_str()); + ServerInstance->Logs.Debug(MODNAME, "Registering cap %s", cap->GetName().c_str()); cap->bit = AllocateBit(); cap->extitem = &capext; caps.emplace(cap->GetName(), cap); @@ -180,7 +180,7 @@ public: if (!cap->IsRegistered()) return; - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Unregistering cap %s", cap->GetName().c_str()); + ServerInstance->Logs.Debug(MODNAME, "Unregistering cap %s", cap->GetName().c_str()); // Fire the event first so modules can still see who is using the cap which is being unregistered evprov.Call(&Cap::EventListener::OnCapAddDel, cap, false); @@ -204,7 +204,7 @@ public: void NotifyValueChange(Capability* cap) override { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Cap %s changed value", cap->GetName().c_str()); + ServerInstance->Logs.Debug(MODNAME, "Cap %s changed value", cap->GetName().c_str()); evprov.Call(&Cap::EventListener::OnCapValueChange, cap); } diff --git a/src/modules/m_chanlog.cpp b/src/modules/m_chanlog.cpp index 70af05bf5..fc4611faf 100644 --- a/src/modules/m_chanlog.cpp +++ b/src/modules/m_chanlog.cpp @@ -58,7 +58,7 @@ public: for (const auto& snomask : snomasks) { newlogs.emplace(snomask, channel); - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Logging %c to %s", snomask, channel.c_str()); + ServerInstance->Logs.Normal(MODNAME, "Logging %c to %s", snomask, channel.c_str()); } } logstreams.swap(newlogs); diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp index 828262ed0..c78712839 100644 --- a/src/modules/m_cloaking.cpp +++ b/src/modules/m_cloaking.cpp @@ -166,7 +166,7 @@ public: } catch (CoreException& modexcept) { - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Exception caught when generating cloak: " + modexcept.GetReason()); + ServerInstance->Logs.Normal(MODNAME, "Exception caught when generating cloak: " + modexcept.GetReason()); return MODEACTION_DENY; } } diff --git a/src/modules/m_codepage.cpp b/src/modules/m_codepage.cpp index df447a930..90d771e78 100644 --- a/src/modules/m_codepage.cpp +++ b/src/modules/m_codepage.cpp @@ -282,7 +282,7 @@ public: switch (newcodepage->AllowCharacter(static_cast<uint32_t>(pos), front)) { case Codepage::ACR_OKAY: - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Marked %lu (%.4s) as allowed (front: %s)", + ServerInstance->Logs.Debug(MODNAME, "Marked %lu (%.4s) as allowed (front: %s)", pos, reinterpret_cast<unsigned char*>(&pos), front ? "yes" : "no"); break; @@ -310,7 +310,7 @@ public: if (!newcodepage->Map(upper, lower)) throw ModuleException(this, "Malformed <cpcase> tag at " + tag->source.str()); - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Marked %lu (%.4s) as the lower case version of %lu (%.4s)", + ServerInstance->Logs.Debug(MODNAME, "Marked %lu (%.4s) as the lower case version of %lu (%.4s)", lower, reinterpret_cast<unsigned char*>(&lower), upper, reinterpret_cast<unsigned char*>(&upper)); } diff --git a/src/modules/m_connectban.cpp b/src/modules/m_connectban.cpp index 0b279adf4..e074c9cc7 100644 --- a/src/modules/m_connectban.cpp +++ b/src/modules/m_connectban.cpp @@ -64,7 +64,7 @@ private: } // If we have reached this point then we have encountered a bug. - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "BUG: ModuleConnectBan::GetRange(): socket type %d is unknown!", family); + ServerInstance->Logs.Debug(MODNAME, "BUG: ModuleConnectBan::GetRange(): socket type %d is unknown!", family); return 0; } @@ -170,7 +170,7 @@ public: void OnGarbageCollect() override { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Clearing map."); + ServerInstance->Logs.Debug(MODNAME, "Clearing map."); connects.clear(); } }; diff --git a/src/modules/m_customprefix.cpp b/src/modules/m_customprefix.cpp index 74abde099..093f8a9e0 100644 --- a/src/modules/m_customprefix.cpp +++ b/src/modules/m_customprefix.cpp @@ -38,7 +38,7 @@ public: bool depriv = tag->getBool("depriv", true); this->Update(rank, setrank, unsetrank, depriv); - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Created the %s prefix: letter=%c prefix=%c rank=%u ranktoset=%u ranktounset=%i depriv=%d", + ServerInstance->Logs.Debug(MODNAME, "Created the %s prefix: letter=%c prefix=%c rank=%u ranktoset=%u ranktounset=%i depriv=%d", name.c_str(), GetModeChar(), GetPrefix(), GetPrefixRank(), GetLevelRequired(true), GetLevelRequired(false), CanSelfRemove()); } }; @@ -82,7 +82,7 @@ public: bool depriv = tag->getBool("depriv", pm->CanSelfRemove()); pm->Update(rank, setrank, unsetrank, depriv); - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Changed the %s prefix: depriv=%u rank=%u ranktoset=%u ranktounset=%u", + ServerInstance->Logs.Debug(MODNAME, "Changed the %s prefix: depriv=%u rank=%u ranktoset=%u ranktounset=%u", pm->name.c_str(), pm->CanSelfRemove(), pm->GetPrefixRank(), pm->GetLevelRequired(true), pm->GetLevelRequired(false)); continue; } diff --git a/src/modules/m_customtitle.cpp b/src/modules/m_customtitle.cpp index a27a1d2d0..bfd2f420e 100644 --- a/src/modules/m_customtitle.cpp +++ b/src/modules/m_customtitle.cpp @@ -127,7 +127,7 @@ public: const std::string hash = tag->getString("hash", "plaintext", 1); if (stdalgo::string::equalsci(hash, "plaintext")) { - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "<title> tag for %s at %s contains an plain text password, this is insecure!", + ServerInstance->Logs.Normal(MODNAME, "<title> tag for %s at %s contains an plain text password, this is insecure!", name.c_str(), tag->source.str().c_str()); } diff --git a/src/modules/m_dccallow.cpp b/src/modules/m_dccallow.cpp index bffa96872..31032d81b 100644 --- a/src/modules/m_dccallow.cpp +++ b/src/modules/m_dccallow.cpp @@ -135,7 +135,7 @@ public: // Check we have space for another entry. if (list->size() >= maxentries) { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Oversized DCC allow list received for %s: %s", + ServerInstance->Logs.Debug(MODNAME, "Oversized DCC allow list received for %s: %s", user->uuid.c_str(), value.c_str()); delete list; return; @@ -148,7 +148,7 @@ public: !ts.GetNumericToken(dccallow.set_on) || !ts.GetNumericToken(dccallow.length)) { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Malformed DCC allow list received for %s: %s", + ServerInstance->Logs.Debug(MODNAME, "Malformed DCC allow list received for %s: %s", user->uuid.c_str(), value.c_str()); delete list; return; diff --git a/src/modules/m_disable.cpp b/src/modules/m_disable.cpp index 1e77a609b..774ecb278 100644 --- a/src/modules/m_disable.cpp +++ b/src/modules/m_disable.cpp @@ -58,7 +58,7 @@ private: chr, field.c_str(), tag->source.str().c_str())); // Disable the mode. - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "The %c (%s) %s mode has been disabled", + ServerInstance->Logs.Debug(MODNAME, "The %c (%s) %s mode has been disabled", mh->GetModeChar(), mh->name.c_str(), type == MODETYPE_CHANNEL ? "channel" : "user"); status.set(ModeParser::GetModeIndex(chr)); } @@ -72,7 +72,7 @@ private: if (notifyopers) ServerInstance->SNO.WriteToSnoMask('a', buffer); else - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, buffer); + ServerInstance->Logs.Normal(MODNAME, buffer); } public: @@ -101,7 +101,7 @@ public: continue; // Disable the command. - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "The %s command has been disabled", handler->name.c_str()); + ServerInstance->Logs.Debug(MODNAME, "The %s command has been disabled", handler->name.c_str()); newcommands.push_back(handler->name); } diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp index fb5ee30ff..cbeac201b 100644 --- a/src/modules/m_dnsbl.cpp +++ b/src/modules/m_dnsbl.cpp @@ -437,7 +437,7 @@ public: else return; - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Reversed IP %s -> %s", user->GetIPString().c_str(), reversedip.c_str()); + ServerInstance->Logs.Debug(MODNAME, "Reversed IP %s -> %s", user->GetIPString().c_str(), reversedip.c_str()); countExt.Set(user, dnsbls.size()); @@ -456,7 +456,7 @@ public: catch (const DNS::Exception& ex) { delete r; - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, ex.GetReason()); + ServerInstance->Logs.Debug(MODNAME, ex.GetReason()); } if (user->quitting) @@ -473,14 +473,14 @@ public: std::string* match = nameExt.Get(user); if (!match) { - ServerInstance->Logs.Log("CONNECTCLASS", LOG_DEBUG, "The %s connect class is not suitable as it requires a DNSBL mark", + ServerInstance->Logs.Debug("CONNECTCLASS", "The %s connect class is not suitable as it requires a DNSBL mark", myclass->GetName().c_str()); return MOD_RES_DENY; } if (!InspIRCd::Match(*match, dnsbl)) { - ServerInstance->Logs.Log("CONNECTCLASS", LOG_DEBUG, "The %s connect class is not suitable as the DNSBL mark (%s) does not match %s", + ServerInstance->Logs.Debug("CONNECTCLASS", "The %s connect class is not suitable as the DNSBL mark (%s) does not match %s", myclass->GetName().c_str(), match->c_str(), dnsbl.c_str()); return MOD_RES_DENY; } diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp index 2f3474461..ba8845cfe 100644 --- a/src/modules/m_filter.cpp +++ b/src/modules/m_filter.cpp @@ -504,7 +504,7 @@ ModResult ModuleFilter::OnUserPreMessage(User* user, const MessageTarget& msgtar delete zl; } - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, user->nick + " had their message filtered, target was " + msgtarget.GetName() + ": " + f->reason + " Action: " + ModuleFilter::FilterActionToString(f->action)); + ServerInstance->Logs.Normal(MODNAME, user->nick + " had their message filtered, target was " + msgtarget.GetName() + ": " + f->reason + " Action: " + ModuleFilter::FilterActionToString(f->action)); return MOD_RES_DENY; } return MOD_RES_PASSTHRU; @@ -749,7 +749,7 @@ void ModuleFilter::OnDecodeMetaData(Extensible* target, const std::string &extna } catch (const ModuleException& e) { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Error when unserializing filter: " + e.GetReason()); + ServerInstance->Logs.Debug(MODNAME, "Error when unserializing filter: " + e.GetReason()); } } } @@ -809,7 +809,7 @@ std::pair<bool, std::string> ModuleFilter::AddFilter(const std::string& freeform } catch (const ModuleException& e) { - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Error in regular expression '%s': %s", freeform.c_str(), e.GetReason().c_str()); + ServerInstance->Logs.Normal(MODNAME, "Error in regular expression '%s': %s", freeform.c_str(), e.GetReason().c_str()); return std::make_pair(false, e.GetReason()); } return std::make_pair(true, ""); @@ -888,7 +888,7 @@ void ModuleFilter::ReadFilters() if (result.first) removedfilters.erase(pattern); else - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Filter '%s' could not be added: %s", pattern.c_str(), result.second.c_str()); + ServerInstance->Logs.Normal(MODNAME, "Filter '%s' could not be added: %s", pattern.c_str(), result.second.c_str()); } if (!removedfilters.empty()) diff --git a/src/modules/m_gateway.cpp b/src/modules/m_gateway.cpp index 32d9c0ca3..15e827507 100644 --- a/src/modules/m_gateway.cpp +++ b/src/modules/m_gateway.cpp @@ -392,7 +392,7 @@ public: if (!password.empty() && stdalgo::string::equalsci(passwordhash, "plaintext")) { - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "<%s> tag at %s contains an plain text password, this is insecure!", + ServerInstance->Logs.Normal(MODNAME, "<%s> tag at %s contains an plain text password, this is insecure!", tag->name.c_str(), tag->source.str().c_str()); } @@ -421,7 +421,7 @@ public: const std::string* gateway = cmdwebirc.extban.gateway.Get(user); if (!gateway) { - ServerInstance->Logs.Log("CONNECTCLASS", LOG_DEBUG, "The %s connect class is not suitable as it requires a connection via a WebIRC gateway", + ServerInstance->Logs.Debug("CONNECTCLASS", "The %s connect class is not suitable as it requires a connection via a WebIRC gateway", myclass->GetName().c_str()); return MOD_RES_DENY; } @@ -430,7 +430,7 @@ public: // allow the check to continue. Otherwise, reject it. if (!InspIRCd::Match(*gateway, webirc)) { - ServerInstance->Logs.Log("CONNECTCLASS", LOG_DEBUG, "The %s connect class is not suitable as the WebIRC gateway name (%s) does not match %s", + ServerInstance->Logs.Debug("CONNECTCLASS", "The %s connect class is not suitable as the WebIRC gateway name (%s) does not match %s", myclass->GetName().c_str(), gateway->c_str(), webirc.c_str()); return MOD_RES_DENY; } @@ -497,7 +497,7 @@ public: default: // If we have reached this point then we have encountered a bug. - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "BUG: OnWebIRCAuth(%s): socket type %d is unknown!", + ServerInstance->Logs.Debug(MODNAME, "BUG: OnWebIRCAuth(%s): socket type %d is unknown!", user->uuid.c_str(), user->client_sa.family()); return; } @@ -523,7 +523,7 @@ public: default: // If we have reached this point then we have encountered a bug. - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "BUG: OnWebIRCAuth(%s): socket type %d is unknown!", + ServerInstance->Logs.Debug(MODNAME, "BUG: OnWebIRCAuth(%s): socket type %d is unknown!", user->uuid.c_str(), user->server_sa.family()); return; } diff --git a/src/modules/m_geoclass.cpp b/src/modules/m_geoclass.cpp index f962750d3..4a0e53830 100644 --- a/src/modules/m_geoclass.cpp +++ b/src/modules/m_geoclass.cpp @@ -58,7 +58,7 @@ public: // A list of country codes were specified but the user didn't match // any of them. - ServerInstance->Logs.Log("CONNECTCLASS", LOG_DEBUG, "The %s connect class is not suitable as the origin country (%s) is not any of %s", + ServerInstance->Logs.Debug("CONNECTCLASS", "The %s connect class is not suitable as the origin country (%s) is not any of %s", myclass->GetName().c_str(), code.c_str(), country.c_str()); return MOD_RES_DENY; } diff --git a/src/modules/m_hidemode.cpp b/src/modules/m_hidemode.cpp index 4c1200e96..56acdd01e 100644 --- a/src/modules/m_hidemode.cpp +++ b/src/modules/m_hidemode.cpp @@ -52,7 +52,7 @@ public: if (!rank) throw ModuleException(mod, "<hidemode:rank> must be greater than 0 at " + tag->source.str()); - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Hiding the %s mode from users below rank %lu", modename.c_str(), rank); + ServerInstance->Logs.Debug(MODNAME, "Hiding the %s mode from users below rank %lu", modename.c_str(), rank); newranks.emplace(modename, rank); } rankstosee.swap(newranks); diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp index 8bce18626..b6d919c05 100644 --- a/src/modules/m_httpd.cpp +++ b/src/modules/m_httpd.cpp @@ -82,7 +82,7 @@ private: { if (!messagecomplete) { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "HTTP socket %d timed out", GetFd()); + ServerInstance->Logs.Debug(MODNAME, "HTTP socket %d timed out", GetFd()); Close(); return false; } @@ -216,7 +216,7 @@ public: // IOHook may have errored if (!GetError().empty()) { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "HTTP socket %d encountered a hook error: %s", + ServerInstance->Logs.Debug(MODNAME, "HTTP socket %d encountered a hook error: %s", GetFd(), GetError().c_str()); Close(); return; @@ -245,7 +245,7 @@ public: void OnError(BufferedSocketError err) override { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "HTTP socket %d encountered an error: %d - %s", + ServerInstance->Logs.Debug(MODNAME, "HTTP socket %d encountered an error: %d - %s", GetFd(), err, GetError().c_str()); Close(); } @@ -255,7 +255,7 @@ public: if (!errstr) errstr = http_status_str((http_status)response); - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Sending HTTP error %u: %s", response, errstr); + ServerInstance->Logs.Debug(MODNAME, "Sending HTTP error %u: %s", response, errstr); static HTTPHeaders empty; std::string data = InspIRCd::Format( "<html><head></head><body style='font-family: sans-serif; text-align: center'>" diff --git a/src/modules/m_httpd_acl.cpp b/src/modules/m_httpd_acl.cpp index a9ca979ef..66f6f8bb2 100644 --- a/src/modules/m_httpd_acl.cpp +++ b/src/modules/m_httpd_acl.cpp @@ -92,7 +92,7 @@ public: } } - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Read ACL: path=%s pass=%s whitelist=%s blacklist=%s", path.c_str(), + ServerInstance->Logs.Debug(MODNAME, "Read ACL: path=%s pass=%s whitelist=%s blacklist=%s", path.c_str(), password.c_str(), whitelist.c_str(), blacklist.c_str()); new_acls.emplace_back(path, username, password, whitelist, blacklist); @@ -102,7 +102,7 @@ public: void BlockAccess(HTTPRequest* http, unsigned int returnval, const std::string &extraheaderkey = "", const std::string &extraheaderval="") { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "BlockAccess (%u)", returnval); + ServerInstance->Logs.Debug(MODNAME, "BlockAccess (%u)", returnval); std::stringstream data; data << "<html><head></head><body style='font-family: sans-serif; text-align: center'>" @@ -121,7 +121,7 @@ public: bool IsAccessAllowed(HTTPRequest* http) { { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Handling httpd acl event"); + ServerInstance->Logs.Debug(MODNAME, "Handling httpd acl event"); for (const auto& acl : acl_list) { @@ -137,7 +137,7 @@ public: { if (InspIRCd::Match(http->GetIP(), entry, ascii_case_insensitive_map)) { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Denying access to blacklisted resource %s (matched by pattern %s) from ip %s (matched by entry %s)", + ServerInstance->Logs.Debug(MODNAME, "Denying access to blacklisted resource %s (matched by pattern %s) from ip %s (matched by entry %s)", http->GetPath().c_str(), acl.path.c_str(), http->GetIP().c_str(), entry.c_str()); BlockAccess(http, 403); return false; @@ -159,7 +159,7 @@ public: if (!allow_access) { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Denying access to whitelisted resource %s (matched by pattern %s) from ip %s (Not in whitelist)", + ServerInstance->Logs.Debug(MODNAME, "Denying access to whitelisted resource %s (matched by pattern %s) from ip %s (Not in whitelist)", http->GetPath().c_str(), acl.path.c_str(), http->GetIP().c_str()); BlockAccess(http, 403); return false; @@ -168,7 +168,7 @@ public: if (!acl.password.empty() && !acl.username.empty()) { /* Password auth, first look to see if we have a basic authentication header */ - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Checking HTTP auth password for resource %s (matched by pattern %s) from ip %s, against username %s", + ServerInstance->Logs.Debug(MODNAME, "Checking HTTP auth password for resource %s (matched by pattern %s) from ip %s, against username %s", http->GetPath().c_str(), acl.path.c_str(), http->GetIP().c_str(), acl.username.c_str()); if (http->headers->IsSet("Authorization")) @@ -187,7 +187,7 @@ public: sep.GetToken(base64); std::string userpass = Base64::Decode(base64); - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "HTTP authorization: %s (%s)", userpass.c_str(), base64.c_str()); + ServerInstance->Logs.Debug(MODNAME, "HTTP authorization: %s (%s)", userpass.c_str(), base64.c_str()); irc::sepstream userpasspair(userpass, ':'); if (userpasspair.GetToken(user)) @@ -197,34 +197,34 @@ public: /* Access granted if username and password are correct */ if (InspIRCd::TimingSafeCompare(user, acl.username) && InspIRCd::TimingSafeCompare(pass, acl.password)) { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "HTTP authorization: password and username match"); + ServerInstance->Logs.Debug(MODNAME, "HTTP authorization: password and username match"); return true; } else { /* Invalid password */ - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "HTTP authorization: password and username do not match"); + ServerInstance->Logs.Debug(MODNAME, "HTTP authorization: password and username do not match"); BlockAccess(http, 401, "WWW-Authenticate", "Basic realm=\"Restricted Object\""); } } else { /* Malformed user:pass pair */ - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "HTTP authorization: password and username malformed"); + ServerInstance->Logs.Debug(MODNAME, "HTTP authorization: password and username malformed"); BlockAccess(http, 401, "WWW-Authenticate", "Basic realm=\"Restricted Object\""); } } else { /* Unsupported authentication type */ - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "HTTP authorization: unsupported auth type: %s", authtype.c_str()); + ServerInstance->Logs.Debug(MODNAME, "HTTP authorization: unsupported auth type: %s", authtype.c_str()); BlockAccess(http, 401, "WWW-Authenticate", "Basic realm=\"Restricted Object\""); } } else { /* No password given at all, access denied */ - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "HTTP authorization: password and username not sent"); + ServerInstance->Logs.Debug(MODNAME, "HTTP authorization: password and username not sent"); BlockAccess(http, 401, "WWW-Authenticate", "Basic realm=\"Restricted Object\""); } return false; diff --git a/src/modules/m_httpd_config.cpp b/src/modules/m_httpd_config.cpp index a921aebc2..986eb6b85 100644 --- a/src/modules/m_httpd_config.cpp +++ b/src/modules/m_httpd_config.cpp @@ -45,7 +45,7 @@ public: if (request.GetPath() != "/config") return MOD_RES_PASSTHRU; - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Handling HTTP request for %s", request.GetPath().c_str()); + ServerInstance->Logs.Debug(MODNAME, "Handling HTTP request for %s", request.GetPath().c_str()); std::stringstream buffer; for (const auto& [_, tag] : ServerInstance->Config->config_data) diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp index be98767c8..91bfba6ca 100644 --- a/src/modules/m_httpd_stats.cpp +++ b/src/modules/m_httpd_stats.cpp @@ -408,7 +408,7 @@ public: if (http->GetPath().compare(0, 6, "/stats")) return MOD_RES_PASSTHRU; - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Handling HTTP request for %s", http->GetPath().c_str()); + ServerInstance->Logs.Debug(MODNAME, "Handling HTTP request for %s", http->GetPath().c_str()); bool found = true; std::stringstream data; diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp index fa4b44930..7a943ca7c 100644 --- a/src/modules/m_ident.cpp +++ b/src/modules/m_ident.cpp @@ -190,7 +190,7 @@ public: */ if (HasFd()) { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Close ident socket %d", GetFd()); + ServerInstance->Logs.Debug(MODNAME, "Close ident socket %d", GetFd()); SocketEngine::Close(this); } } @@ -220,7 +220,7 @@ public: if (recvresult < 3) return; - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "ReadResponse()"); + ServerInstance->Logs.Debug(MODNAME, "ReadResponse()"); /* Truncate at the first null character, but first make sure * there is at least one null char (at the end of the buffer). @@ -349,7 +349,7 @@ public: } catch (const ModuleException& e) { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Ident exception: " + e.GetReason()); + ServerInstance->Logs.Debug(MODNAME, "Ident exception: " + e.GetReason()); } } @@ -410,7 +410,7 @@ public: { if (myclass->config->getBool("requireident") && state.Get(user) != IDENT_FOUND) { - ServerInstance->Logs.Log("CONNECTCLASS", LOG_DEBUG, "The %s connect class is not suitable as it requires an identd response", + ServerInstance->Logs.Debug("CONNECTCLASS", "The %s connect class is not suitable as it requires an identd response", myclass->GetName().c_str()); return MOD_RES_DENY; } diff --git a/src/modules/m_ircv3_sts.cpp b/src/modules/m_ircv3_sts.cpp index cbfb45464..d2823f895 100644 --- a/src/modules/m_ircv3_sts.cpp +++ b/src/modules/m_ircv3_sts.cpp @@ -100,21 +100,21 @@ public: bool changed = false; if (!irc::equals(host, newhost)) { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Changing STS SNI hostname from \"%s\" to \"%s\"", host.c_str(), newhost.c_str()); + ServerInstance->Logs.Debug(MODNAME, "Changing STS SNI hostname from \"%s\" to \"%s\"", host.c_str(), newhost.c_str()); host = newhost; changed = true; } if (plaintextpolicy != newplaintextpolicy) { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Changing plaintext STS policy from \"%s\" to \"%s\"", plaintextpolicy.c_str(), newplaintextpolicy.c_str()); + ServerInstance->Logs.Debug(MODNAME, "Changing plaintext STS policy from \"%s\" to \"%s\"", plaintextpolicy.c_str(), newplaintextpolicy.c_str()); plaintextpolicy.swap(newplaintextpolicy); changed = true; } if (securepolicy != newsecurepolicy) { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Changing secure STS policy from \"%s\" to \"%s\"", securepolicy.c_str(), newsecurepolicy.c_str()); + ServerInstance->Logs.Debug(MODNAME, "Changing secure STS policy from \"%s\" to \"%s\"", securepolicy.c_str(), newsecurepolicy.c_str()); securepolicy.swap(newsecurepolicy); changed = true; } diff --git a/src/modules/m_ldapauth.cpp b/src/modules/m_ldapauth.cpp index 7d38250bd..00eb4f518 100644 --- a/src/modules/m_ldapauth.cpp +++ b/src/modules/m_ldapauth.cpp @@ -161,7 +161,7 @@ public: for (const auto& [attr, val] : requiredattributes) { // Note that only one of these has to match for it to be success - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "LDAP compare: %s=%s", attr.c_str(), val.c_str()); + ServerInstance->Logs.Debug(MODNAME, "LDAP compare: %s=%s", attr.c_str(), val.c_str()); try { LDAP->Compare(this, DN, attr, val); diff --git a/src/modules/m_operlog.cpp b/src/modules/m_operlog.cpp index 3d1ea889a..ff2f15768 100644 --- a/src/modules/m_operlog.cpp +++ b/src/modules/m_operlog.cpp @@ -58,7 +58,7 @@ public: if (tosnomask) ServerInstance->SNO.WriteGlobalSno('o', msg); else - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, msg); + ServerInstance->Logs.Normal(MODNAME, msg); } } diff --git a/src/modules/m_password_hash.cpp b/src/modules/m_password_hash.cpp index fcb1a9f2b..d7f9002a1 100644 --- a/src/modules/m_password_hash.cpp +++ b/src/modules/m_password_hash.cpp @@ -114,7 +114,7 @@ public: if (hp->IsKDF()) { - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Tried to use HMAC with %s, which does not support HMAC", type.c_str()); + ServerInstance->Logs.Normal(MODNAME, "Tried to use HMAC with %s, which does not support HMAC", type.c_str()); return MOD_RES_DENY; } diff --git a/src/modules/m_permchannels.cpp b/src/modules/m_permchannels.cpp index cbc6097a2..24f467ac8 100644 --- a/src/modules/m_permchannels.cpp +++ b/src/modules/m_permchannels.cpp @@ -77,7 +77,7 @@ static bool WriteDatabase(PermChannel& permchanmode, Module* mod, bool save_list std::ofstream stream(permchannelsnewconf); if (!stream.is_open()) { - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Cannot create database \"%s\"! %s (%d)", permchannelsnewconf.c_str(), strerror(errno), errno); + ServerInstance->Logs.Normal(MODNAME, "Cannot create database \"%s\"! %s (%d)", permchannelsnewconf.c_str(), strerror(errno), errno); ServerInstance->SNO.WriteToSnoMask('a', "database: cannot create new permchan db \"%s\": %s (%d)", permchannelsnewconf.c_str(), strerror(errno), errno); return false; } @@ -145,7 +145,7 @@ static bool WriteDatabase(PermChannel& permchanmode, Module* mod, bool save_list if (stream.fail()) { - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Cannot write to new database \"%s\"! %s (%d)", permchannelsnewconf.c_str(), strerror(errno), errno); + ServerInstance->Logs.Normal(MODNAME, "Cannot write to new database \"%s\"! %s (%d)", permchannelsnewconf.c_str(), strerror(errno), errno); ServerInstance->SNO.WriteToSnoMask('a', "database: cannot write to new permchan db \"%s\": %s (%d)", permchannelsnewconf.c_str(), strerror(errno), errno); return false; } @@ -157,7 +157,7 @@ static bool WriteDatabase(PermChannel& permchanmode, Module* mod, bool save_list // Use rename to move temporary to new db - this is guaranteed not to fuck up, even in case of a crash. if (rename(permchannelsnewconf.c_str(), permchannelsconf.c_str()) < 0) { - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Cannot replace old database \"%s\" with new database \"%s\"! %s (%d)", permchannelsconf.c_str(), permchannelsnewconf.c_str(), strerror(errno), errno); + ServerInstance->Logs.Normal(MODNAME, "Cannot replace old database \"%s\" with new database \"%s\"! %s (%d)", permchannelsconf.c_str(), permchannelsnewconf.c_str(), strerror(errno), errno); ServerInstance->SNO.WriteToSnoMask('a', "database: cannot replace old permchan db \"%s\" with new db \"%s\": %s (%d)", permchannelsconf.c_str(), permchannelsnewconf.c_str(), strerror(errno), errno); return false; } @@ -207,7 +207,7 @@ public: if (!ServerInstance->Channels.IsChannel(channel)) { - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Ignoring permchannels tag with invalid channel name (\"" + channel + "\")"); + ServerInstance->Logs.Normal(MODNAME, "Ignoring permchannels tag with invalid channel name (\"" + channel + "\")"); continue; } @@ -230,7 +230,7 @@ public: c->SetTopic(ServerInstance->FakeClient, topic, topicset, &topicsetby); } - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Added %s with topic %s", channel.c_str(), c->topic.c_str()); + ServerInstance->Logs.Debug(MODNAME, "Added %s with topic %s", channel.c_str(), c->topic.c_str()); std::string modes = tag->getString("modes"); if (modes.empty()) @@ -313,7 +313,7 @@ public: } catch (CoreException& e) { - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Error loading permchannels database: " + std::string(e.GetReason())); + ServerInstance->Logs.Normal(MODNAME, "Error loading permchannels database: " + std::string(e.GetReason())); } } } diff --git a/src/modules/m_sasl.cpp b/src/modules/m_sasl.cpp index eb7cfe739..2100080dd 100644 --- a/src/modules/m_sasl.cpp +++ b/src/modules/m_sasl.cpp @@ -57,7 +57,7 @@ private: if (InspIRCd::Match(server->GetName(), sasl_target)) { - ServerInstance->Logs.Log(MODNAME, LOG_VERBOSE, "SASL target server \"%s\" %s", sasl_target.c_str(), (linked ? "came online" : "went offline")); + ServerInstance->Logs.Normal(MODNAME, "SASL target server \"%s\" %s", sasl_target.c_str(), (linked ? "came online" : "went offline")); online = linked; } } @@ -257,7 +257,7 @@ public: else if (msg[2] == "M") this->user->WriteNumeric(RPL_SASLMECHS, msg[3], "are available SASL mechanisms"); else - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Services sent an unknown SASL message \"%s\" \"%s\"", msg[2].c_str(), msg[3].c_str()); + ServerInstance->Logs.Normal(MODNAME, "Services sent an unknown SASL message \"%s\" \"%s\"", msg[2].c_str(), msg[3].c_str()); break; case SASL_DONE: @@ -376,7 +376,7 @@ public: User* target = ServerInstance->Users.FindUUID(parameters[1]); if (!target) { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "User not found in sasl ENCAP event: %s", parameters[1].c_str()); + ServerInstance->Logs.Debug(MODNAME, "User not found in sasl ENCAP event: %s", parameters[1].c_str()); return CmdResult::FAILURE; } @@ -426,7 +426,7 @@ public: void init() override { if (!ServerInstance->Modules.Find("services_account") || !ServerInstance->Modules.Find("cap")) - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "WARNING: m_services_account and m_cap are not loaded! m_sasl will NOT function correctly until these two modules are loaded!"); + ServerInstance->Logs.Normal(MODNAME, "WARNING: m_services_account and m_cap are not loaded! m_sasl will NOT function correctly until these two modules are loaded!"); } void ReadConfig(ConfigStatus& status) override diff --git a/src/modules/m_services_account.cpp b/src/modules/m_services_account.cpp index 4ad6c1721..7475ad48d 100644 --- a/src/modules/m_services_account.cpp +++ b/src/modules/m_services_account.cpp @@ -310,7 +310,7 @@ public: { if (myclass->config->getBool("requireaccount") && !accountname.Get(user)) { - ServerInstance->Logs.Log("CONNECTCLASS", LOG_DEBUG, "The %s connect class is not suitable as it requires the user to be logged into an account", + ServerInstance->Logs.Debug("CONNECTCLASS", "The %s connect class is not suitable as it requires the user to be logged into an account", myclass->GetName().c_str()); return MOD_RES_DENY; } diff --git a/src/modules/m_showfile.cpp b/src/modules/m_showfile.cpp index d2f380809..48fab7a2d 100644 --- a/src/modules/m_showfile.cpp +++ b/src/modules/m_showfile.cpp @@ -159,7 +159,7 @@ public: } catch (CoreException& ex) { - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Error: " + ex.GetReason() + " at " + tag->source.str()); + ServerInstance->Logs.Normal(MODNAME, "Error: " + ex.GetReason() + " at " + tag->source.str()); } } diff --git a/src/modules/m_silence.cpp b/src/modules/m_silence.cpp index dc26ce4b6..77a5d6ec1 100644 --- a/src/modules/m_silence.cpp +++ b/src/modules/m_silence.cpp @@ -214,7 +214,7 @@ public: // Check we have space for another entry. if (list->size() >= maxsilence) { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Oversized silence list received for %s: %s", + ServerInstance->Logs.Debug(MODNAME, "Oversized silence list received for %s: %s", user->uuid.c_str(), value.c_str()); delete list; return; @@ -225,7 +225,7 @@ public: std::string flagstr; if (!ts.GetToken(mask) || !ts.GetToken(flagstr)) { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Malformed silence list received for %s: %s", + ServerInstance->Logs.Debug(MODNAME, "Malformed silence list received for %s: %s", user->uuid.c_str(), value.c_str()); delete list; return; @@ -235,7 +235,7 @@ public: uint32_t flags; if (!SilenceEntry::FlagsToBits(flagstr, flags)) { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Malformed silence flags received for %s: %s", + ServerInstance->Logs.Debug(MODNAME, "Malformed silence flags received for %s: %s", user->uuid.c_str(), flagstr.c_str()); delete list; return; diff --git a/src/modules/m_spanningtree/fjoin.cpp b/src/modules/m_spanningtree/fjoin.cpp index 47b6497a8..e5470d9c2 100644 --- a/src/modules/m_spanningtree/fjoin.cpp +++ b/src/modules/m_spanningtree/fjoin.cpp @@ -130,7 +130,7 @@ CmdResult CommandFJoin::Handle(User* srcuser, Params& params) time_t ourTS = chan->age; if (TS != ourTS) { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Merge FJOIN received for %s, ourTS: %lu, TS: %lu, difference: %ld", + ServerInstance->Logs.Debug(MODNAME, "Merge FJOIN received for %s, ourTS: %lu, TS: %lu, difference: %ld", chan->name.c_str(), (unsigned long)ourTS, (unsigned long)TS, (long)(ourTS - TS)); /* If our TS is less than theirs, we dont accept their modes */ if (ourTS < TS) @@ -140,7 +140,7 @@ CmdResult CommandFJoin::Handle(User* srcuser, Params& params) // Servers behind us won't react this way because the forwarded FJOIN will have the correct TS. if (!sourceserver->IsBursting()) { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Server %s recreated channel %s with higher TS, resyncing", sourceserver->GetName().c_str(), chan->name.c_str()); + ServerInstance->Logs.Debug(MODNAME, "Server %s recreated channel %s with higher TS, resyncing", sourceserver->GetName().c_str(), chan->name.c_str()); sourceserver->GetSocket()->SyncChannel(chan); } apply_other_sides_modes = false; diff --git a/src/modules/m_spanningtree/hmac.cpp b/src/modules/m_spanningtree/hmac.cpp index c97e9a49b..eac406184 100644 --- a/src/modules/m_spanningtree/hmac.cpp +++ b/src/modules/m_spanningtree/hmac.cpp @@ -65,7 +65,7 @@ std::string TreeSocket::MakePass(const std::string &password, const std::string return "AUTH:" + Base64::Encode(sha256->hmac(password, challenge)); if (!challenge.empty() && !sha256) - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Not authenticating to server using SHA256/HMAC because we don't have an SHA256 provider (e.g. the sha2 module) loaded!"); + ServerInstance->Logs.Normal(MODNAME, "Not authenticating to server using SHA256/HMAC because we don't have an SHA256 provider (e.g. the sha2 module) loaded!"); return password; } diff --git a/src/modules/m_spanningtree/ijoin.cpp b/src/modules/m_spanningtree/ijoin.cpp index 38d5edebe..1e756b115 100644 --- a/src/modules/m_spanningtree/ijoin.cpp +++ b/src/modules/m_spanningtree/ijoin.cpp @@ -32,7 +32,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.Log(MODNAME, LOG_DEBUG, "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); @@ -59,12 +59,12 @@ CmdResult CommandIJoin::HandleRemote(RemoteUser* user, Params& params) CmdResult CommandResync::HandleServer(TreeServer* server, CommandBase::Params& params) { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Resyncing " + params[0]); + ServerInstance->Logs.Debug(MODNAME, "Resyncing " + params[0]); Channel* chan = ServerInstance->Channels.Find(params[0]); if (!chan) { // This can happen for a number of reasons, safe to ignore - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Channel does not exist"); + ServerInstance->Logs.Debug(MODNAME, "Channel does not exist"); return CmdResult::FAILURE; } diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index cc41d434e..466cd8b93 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -627,7 +627,7 @@ void ModuleSpanningTree::OnUserPostNick(User* user, const std::string &oldnick) } else if (!loopCall) { - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "WARNING: Changed nick of remote user %s from %s to %s TS %lu by ourselves!", user->uuid.c_str(), oldnick.c_str(), user->nick.c_str(), (unsigned long) user->age); + ServerInstance->Logs.Normal(MODNAME, "WARNING: Changed nick of remote user %s from %s to %s TS %lu by ourselves!", user->uuid.c_str(), oldnick.c_str(), user->nick.c_str(), (unsigned long) user->age); } } @@ -648,7 +648,7 @@ void ModuleSpanningTree::OnUserKick(User* source, Membership* memb, const std::s void ModuleSpanningTree::OnPreRehash(User* user, const std::string ¶meter) { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "OnPreRehash called with param %s", parameter.c_str()); + ServerInstance->Logs.Debug(MODNAME, "OnPreRehash called with param %s", parameter.c_str()); // Send out to other servers if (!parameter.empty() && parameter[0] != '-') diff --git a/src/modules/m_spanningtree/nickcollide.cpp b/src/modules/m_spanningtree/nickcollide.cpp index c98e8ed4a..b0e079de0 100644 --- a/src/modules/m_spanningtree/nickcollide.cpp +++ b/src/modules/m_spanningtree/nickcollide.cpp @@ -90,7 +90,7 @@ bool SpanningTreeUtilities::DoCollision(User* u, TreeServer* server, time_t remo } } - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Nick collision on \"%s\" caused by %s: %s/%lu/%s@%s %d <-> %s/%lu/%s@%s %d", u->nick.c_str(), collidecmd, + ServerInstance->Logs.Debug(MODNAME, "Nick collision on \"%s\" caused by %s: %s/%lu/%s@%s %d <-> %s/%lu/%s@%s %d", u->nick.c_str(), collidecmd, u->uuid.c_str(), (unsigned long)localts, u->ident.c_str(), u->GetIPString().c_str(), bChangeLocal, remoteuid.c_str(), (unsigned long)remotets, remoteident.c_str(), remoteip.c_str(), bChangeRemote); diff --git a/src/modules/m_spanningtree/postcommand.cpp b/src/modules/m_spanningtree/postcommand.cpp index 64fd76852..4769d8a94 100644 --- a/src/modules/m_spanningtree/postcommand.cpp +++ b/src/modules/m_spanningtree/postcommand.cpp @@ -60,7 +60,7 @@ void SpanningTreeUtilities::RouteCommand(TreeServer* origin, CommandBase* thiscm sdest = FindRouteTarget(routing.target); if (!sdest) { - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Trying to route %s%s to nonexistent server %s", (encap ? "ENCAP " : ""), command.c_str(), routing.target.c_str()); + ServerInstance->Logs.Normal(MODNAME, "Trying to route %s%s to nonexistent server %s", (encap ? "ENCAP " : ""), command.c_str(), routing.target.c_str()); return; } } @@ -76,7 +76,7 @@ void SpanningTreeUtilities::RouteCommand(TreeServer* origin, CommandBase* thiscm Module* srcmodule = thiscmd->creator; if (!(srcmodule->properties & (VF_COMMON | VF_CORE)) && srcmodule != Creator) { - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Routed command %s from non-VF_COMMON module %s", + ServerInstance->Logs.Normal(MODNAME, "Routed command %s from non-VF_COMMON module %s", command.c_str(), srcmodule->ModuleSourceFile.c_str()); return; } diff --git a/src/modules/m_spanningtree/resolvers.cpp b/src/modules/m_spanningtree/resolvers.cpp index d8ce53d4a..4c449f2c4 100644 --- a/src/modules/m_spanningtree/resolvers.cpp +++ b/src/modules/m_spanningtree/resolvers.cpp @@ -144,7 +144,7 @@ void SecurityIPResolver::OnLookupComplete(const DNS::Query *r) continue; Utils->ValidIPs.push_back(ans_record.rdata); - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Resolved '%s' as a valid IP address for link '%s'", + ServerInstance->Logs.Normal(MODNAME, "Resolved '%s' as a valid IP address for link '%s'", ans_record.rdata.c_str(), MyLink->Name.c_str()); } break; @@ -160,7 +160,7 @@ void SecurityIPResolver::OnError(const DNS::Query *r) if (CheckIPv4()) return; - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Could not resolve IP associated with link '%s': %s", + ServerInstance->Logs.Debug(MODNAME, "Could not resolve IP associated with link '%s': %s", MyLink->Name.c_str(), this->manager->GetErrorStr(r->error).c_str()); } diff --git a/src/modules/m_spanningtree/server.cpp b/src/modules/m_spanningtree/server.cpp index b12c2e5e5..8f0b68b96 100644 --- a/src/modules/m_spanningtree/server.cpp +++ b/src/modules/m_spanningtree/server.cpp @@ -191,7 +191,7 @@ bool TreeSocket::CheckDuplicate(const std::string& sname, const std::string& sid } // Check if the id is not in use by a server that's already fully connected - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Looking for dupe SID %s", sid.c_str()); + ServerInstance->Logs.Debug(MODNAME, "Looking for dupe SID %s", sid.c_str()); CheckDupe = Utils->FindServerID(sid); if (CheckDupe) diff --git a/src/modules/m_spanningtree/sinfo.cpp b/src/modules/m_spanningtree/sinfo.cpp index 5457d84db..1ea2d1774 100644 --- a/src/modules/m_spanningtree/sinfo.cpp +++ b/src/modules/m_spanningtree/sinfo.cpp @@ -43,7 +43,7 @@ CmdResult CommandSInfo::HandleServer(TreeServer* server, CommandBase::Params& pa else if (key == "desc") { // Only sent when the description of a server changes because of a rehash; not sent on burst - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Server description of " + server->GetName() + " changed: " + value); + ServerInstance->Logs.Normal(MODNAME, "Server description of " + server->GetName() + " changed: " + value); server->SetDesc(value); } diff --git a/src/modules/m_spanningtree/treeserver.cpp b/src/modules/m_spanningtree/treeserver.cpp index 0238c1842..34493716c 100644 --- a/src/modules/m_spanningtree/treeserver.cpp +++ b/src/modules/m_spanningtree/treeserver.cpp @@ -67,7 +67,7 @@ TreeServer::TreeServer(const std::string& Name, const std::string& Desc, const s , UserCount(0) , Hidden(Hide) { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "New server %s behind_bursting %u", GetName().c_str(), behind_bursting); + ServerInstance->Logs.Debug(MODNAME, "New server %s behind_bursting %u", GetName().c_str(), behind_bursting); CheckService(); ServerInstance->Timers.AddTimer(&pingtimer); @@ -138,7 +138,7 @@ void TreeServer::BeginBurst(uint64_t startms) if ((!startms) || (startms > now)) startms = now; this->StartBurst = startms; - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Server %s started bursting at time %s behind_bursting %u", GetId().c_str(), ConvToStr(startms).c_str(), behind_bursting); + ServerInstance->Logs.Debug(MODNAME, "Server %s started bursting at time %s behind_bursting %u", GetId().c_str(), ConvToStr(startms).c_str(), behind_bursting); } void TreeServer::FinishBurstInternal() @@ -147,7 +147,7 @@ void TreeServer::FinishBurstInternal() // introduced during a netburst may later send ENDBURST which would normally decrease this counter if (behind_bursting > 0) behind_bursting--; - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "FinishBurstInternal() %s behind_bursting %u", GetName().c_str(), behind_bursting); + ServerInstance->Logs.Debug(MODNAME, "FinishBurstInternal() %s behind_bursting %u", GetName().c_str(), behind_bursting); for (const auto& child : Children) child->FinishBurstInternal(); @@ -204,7 +204,7 @@ void TreeServer::SQuitInternal(unsigned int& num_lost_servers, bool error) if (isdead) return; - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Server %s lost in split", GetName().c_str()); + ServerInstance->Logs.Debug(MODNAME, "Server %s lost in split", GetName().c_str()); for (const auto& server : Children) server->SQuitInternal(num_lost_servers, error); @@ -247,7 +247,7 @@ void TreeServer::CheckService() { if (this->IsRoot()) { - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Servers should not mark themselves as a service (at " + tag->source.str() + ")"); + ServerInstance->Logs.Normal(MODNAME, "Servers should not mark themselves as a service (at " + tag->source.str() + ")"); return; } diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp index 46525bee3..7cf1e170c 100644 --- a/src/modules/m_spanningtree/treesocket1.cpp +++ b/src/modules/m_spanningtree/treesocket1.cpp @@ -164,7 +164,7 @@ CmdResult CommandSQuit::HandleServer(TreeServer* server, CommandBase::Params& pa TreeServer* quitting = Utils->FindServer(params[0]); if (!quitting) { - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Squit from unknown server"); + ServerInstance->Logs.Normal(MODNAME, "Squit from unknown server"); return CmdResult::FAILURE; } @@ -220,8 +220,8 @@ void TreeSocket::OnDataReady() } catch (CoreException& ex) { - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Error while processing: " + line); - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, ex.GetReason()); + ServerInstance->Logs.Normal(MODNAME, "Error while processing: " + line); + ServerInstance->Logs.Normal(MODNAME, ex.GetReason()); SendError(ex.GetReason() + " - check the log file for details"); } @@ -237,7 +237,7 @@ static std::string newline("\n"); void TreeSocket::WriteLineInternal(const std::string& line) { - ServerInstance->Logs.Log(MODNAME, LOG_RAWIO, "S[%d] O %s", this->GetFd(), line.c_str()); + ServerInstance->Logs.RawIO(MODNAME, "S[%d] O %s", this->GetFd(), line.c_str()); this->WriteData(line); this->WriteData(newline); } diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index de3550b42..0f6cb5d33 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -93,7 +93,7 @@ void TreeSocket::ProcessLine(std::string &line) std::string command; CommandBase::Params params; - ServerInstance->Logs.Log(MODNAME, LOG_RAWIO, "S[%d] I %s", this->GetFd(), line.c_str()); + ServerInstance->Logs.RawIO(MODNAME, "S[%d] I %s", this->GetFd(), line.c_str()); Split(line, tags, prefix, command, params); @@ -308,7 +308,7 @@ void TreeSocket::ProcessConnectedLine(std::string& taglist, std::string& prefix, User* who = FindSource(prefix, command); if (!who) { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Command '%s' from unknown prefix '%s'! Dropping entire command.", command.c_str(), prefix.c_str()); + ServerInstance->Logs.Debug(MODNAME, "Command '%s' from unknown prefix '%s'! Dropping entire command.", command.c_str(), prefix.c_str()); return; } @@ -331,7 +331,7 @@ void TreeSocket::ProcessConnectedLine(std::string& taglist, std::string& prefix, TreeServer* const server = TreeServer::Get(who); if (server->GetSocket() != this) { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Protocol violation: Fake direction '%s' from connection '%s'", prefix.c_str(), linkID.c_str()); + ServerInstance->Logs.Debug(MODNAME, "Protocol violation: Fake direction '%s' from connection '%s'", prefix.c_str(), linkID.c_str()); return; } diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp index 539dbe82f..58b908413 100644 --- a/src/modules/m_spanningtree/utils.cpp +++ b/src/modules/m_spanningtree/utils.cpp @@ -204,7 +204,7 @@ void SpanningTreeUtilities::RefreshIPCache() { if (!L->Port) { - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Ignoring a link block without a port."); + ServerInstance->Logs.Normal(MODNAME, "Ignoring a link block without a port."); /* Invalid link block */ continue; } @@ -293,11 +293,11 @@ void SpanningTreeUtilities::ReadConfiguration() if (L->IPAddr.empty()) { L->IPAddr = "*"; - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Configuration warning: Link block '" + L->Name + "' has no IP defined! This will allow any IP to connect as this server, and MAY not be what you want."); + ServerInstance->Logs.Normal(MODNAME, "Configuration warning: Link block '" + L->Name + "' has no IP defined! This will allow any IP to connect as this server, and MAY not be what you want."); } if (!L->Port && L->IPAddr.find('/') == std::string::npos) - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Configuration warning: Link block '" + L->Name + "' has no port defined, you will not be able to /connect it."); + ServerInstance->Logs.Normal(MODNAME, "Configuration warning: Link block '" + L->Name + "' has no port defined, you will not be able to /connect it."); L->Fingerprint.erase(std::remove(L->Fingerprint.begin(), L->Fingerprint.end(), ':'), L->Fingerprint.end()); LinkBlocks.push_back(L); diff --git a/src/modules/m_sqloper.cpp b/src/modules/m_sqloper.cpp index b6f770cee..fc1cf4e32 100644 --- a/src/modules/m_sqloper.cpp +++ b/src/modules/m_sqloper.cpp @@ -89,7 +89,7 @@ public: ServerConfig::OperIndex::iterator tblk = ServerInstance->Config->OperTypes.find(type); if (tblk == ServerInstance->Config->OperTypes.end()) { - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Sqloper block " + name + " has missing type " + type); + ServerInstance->Logs.Normal(MODNAME, "Sqloper block " + name + " has missing type " + type); ServerInstance->SNO.WriteGlobalSno('a', "m_sqloper: Oper block %s has missing type %s", name.c_str(), type.c_str()); continue; } @@ -114,7 +114,7 @@ public: void OnError(SQL::Error& error) override { - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "query failed (%s)", error.ToString()); + ServerInstance->Logs.Normal(MODNAME, "query failed (%s)", error.ToString()); ServerInstance->SNO.WriteGlobalSno('a', "m_sqloper: Failed to update blocks from database"); if (!uid.empty()) { @@ -154,7 +154,7 @@ public: } else { - ServerInstance->Logs.Log(MODNAME, LOG_SPARSE, "BUG: WHAT?! Why do we have no OPER command?!"); + ServerInstance->Logs.Error(MODNAME, "BUG: WHAT?! Why do we have no OPER command?!"); } } }; @@ -215,7 +215,7 @@ public: */ return MOD_RES_DENY; } - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "database not present"); + ServerInstance->Logs.Normal(MODNAME, "database not present"); } else if (active) { diff --git a/src/modules/m_sslinfo.cpp b/src/modules/m_sslinfo.cpp index 138e8102e..3bacc1402 100644 --- a/src/modules/m_sslinfo.cpp +++ b/src/modules/m_sslinfo.cpp @@ -152,7 +152,7 @@ public: void SetCertificate(User* user, ssl_cert* cert) override { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Setting TLS client certificate for %s: %s", + ServerInstance->Logs.Debug(MODNAME, "Setting TLS client certificate for %s: %s", user->GetFullHost().c_str(), sslext.ToNetwork(user, cert).c_str()); sslext.Set(user, cert); } @@ -416,7 +416,7 @@ public: if (error) { - ServerInstance->Logs.Log("CONNECTCLASS", LOG_DEBUG, "The %s connect class is not suitable as it requires %s", + ServerInstance->Logs.Debug("CONNECTCLASS", "The %s connect class is not suitable as it requires %s", myclass->GetName().c_str(), error); return MOD_RES_DENY; } diff --git a/src/modules/m_topiclock.cpp b/src/modules/m_topiclock.cpp index 30b7ac3f5..744e63ddb 100644 --- a/src/modules/m_topiclock.cpp +++ b/src/modules/m_topiclock.cpp @@ -53,7 +53,7 @@ public: time_t topicts = ConvToNum<time_t>(parameters[1]); if (!topicts) { - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Received SVSTOPIC with a 0 topicts, dropped."); + ServerInstance->Logs.Normal(MODNAME, "Received SVSTOPIC with a 0 topicts, dropped."); return CmdResult::INVALID; } diff --git a/src/modules/m_vhost.cpp b/src/modules/m_vhost.cpp index 04419f893..73c1e1759 100644 --- a/src/modules/m_vhost.cpp +++ b/src/modules/m_vhost.cpp @@ -111,7 +111,7 @@ public: const std::string hash = tag->getString("hash", "plaintext", 1); if (stdalgo::string::equalsci(hash, "plaintext")) { - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "<vhost> tag for %s at %s contains an plain text password, this is insecure!", + ServerInstance->Logs.Normal(MODNAME, "<vhost> tag for %s at %s contains an plain text password, this is insecure!", username.c_str(), tag->source.str().c_str()); } diff --git a/src/modules/m_xline_db.cpp b/src/modules/m_xline_db.cpp index f40c2729c..8d9a8f936 100644 --- a/src/modules/m_xline_db.cpp +++ b/src/modules/m_xline_db.cpp @@ -105,17 +105,17 @@ public: * Technically, that means that this can block, but I have *never* seen that. * -- w00t */ - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Opening temporary database"); + ServerInstance->Logs.Debug(MODNAME, "Opening temporary database"); std::string xlinenewdbpath = xlinedbpath + ".new"; std::ofstream stream(xlinenewdbpath); if (!stream.is_open()) { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Cannot create database \"%s\"! %s (%d)", xlinenewdbpath.c_str(), strerror(errno), errno); + ServerInstance->Logs.Debug(MODNAME, "Cannot create database \"%s\"! %s (%d)", xlinenewdbpath.c_str(), strerror(errno), errno); ServerInstance->SNO.WriteToSnoMask('x', "database: cannot create new xline db \"%s\": %s (%d)", xlinenewdbpath.c_str(), strerror(errno), errno); return false; } - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Opened. Writing.."); + ServerInstance->Logs.Debug(MODNAME, "Opened. Writing.."); /* * Now, much as I hate writing semi-unportable formats, additional @@ -144,11 +144,11 @@ public: } } - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Finished writing XLines. Checking for error.."); + ServerInstance->Logs.Debug(MODNAME, "Finished writing XLines. Checking for error.."); if (stream.fail()) { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Cannot write to new database \"%s\"! %s (%d)", xlinenewdbpath.c_str(), strerror(errno), errno); + ServerInstance->Logs.Debug(MODNAME, "Cannot write to new database \"%s\"! %s (%d)", xlinenewdbpath.c_str(), strerror(errno), errno); ServerInstance->SNO.WriteToSnoMask('x', "database: cannot write to new xline db \"%s\": %s (%d)", xlinenewdbpath.c_str(), strerror(errno), errno); return false; } @@ -160,7 +160,7 @@ public: // Use rename to move temporary to new db - this is guaranteed not to fuck up, even in case of a crash. if (rename(xlinenewdbpath.c_str(), xlinedbpath.c_str()) < 0) { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Cannot replace old database \"%s\" with new database \"%s\"! %s (%d)", xlinedbpath.c_str(), xlinenewdbpath.c_str(), strerror(errno), errno); + ServerInstance->Logs.Debug(MODNAME, "Cannot replace old database \"%s\" with new database \"%s\"! %s (%d)", xlinedbpath.c_str(), xlinenewdbpath.c_str(), strerror(errno), errno); ServerInstance->SNO.WriteToSnoMask('x', "database: cannot replace old xline db \"%s\" with new db \"%s\": %s (%d)", xlinedbpath.c_str(), xlinenewdbpath.c_str(), strerror(errno), errno); return false; } @@ -178,7 +178,7 @@ public: std::ifstream stream(xlinedbpath); if (!stream.is_open()) { - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Cannot read database \"%s\"! %s (%d)", xlinedbpath.c_str(), strerror(errno), errno); + ServerInstance->Logs.Debug(MODNAME, "Cannot read database \"%s\"! %s (%d)", xlinedbpath.c_str(), strerror(errno), errno); ServerInstance->SNO.WriteToSnoMask('x', "database: cannot read xline db \"%s\": %s (%d)", xlinedbpath.c_str(), strerror(errno), errno); return false; } @@ -198,14 +198,14 @@ public: items++; } - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Processing %s", line.c_str()); + ServerInstance->Logs.Debug(MODNAME, "Processing %s", line.c_str()); if (command_p[0] == "VERSION") { if (command_p[1] != "1") { stream.close(); - ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "I got database version %s - I don't understand it", command_p[1].c_str()); + ServerInstance->Logs.Debug(MODNAME, "I got database version %s - I don't understand it", command_p[1].c_str()); ServerInstance->SNO.WriteToSnoMask('x', "database: I got a database version (%s) I don't understand", command_p[1].c_str()); return false; } diff --git a/src/serializable.cpp b/src/serializable.cpp index c37b86c5b..cad72cf8c 100644 --- a/src/serializable.cpp +++ b/src/serializable.cpp @@ -24,12 +24,12 @@ Serializable::Data& Serializable::Data::Load(const std::string& key, std::string EntryMap::iterator iter = this->entries.find(key); if (iter == this->entries.end()) { - ServerInstance->Logs.Log("SERIALIZE", LOG_DEBUG, "Unable to load missing kv %s!", key.c_str()); + ServerInstance->Logs.Debug("SERIALIZE", "Unable to load missing kv %s!", key.c_str()); } else { out = iter->second; - ServerInstance->Logs.Log("SERIALIZE", LOG_DEBUG, "Loaded kv %s: %s", key.c_str(), out.c_str()); + ServerInstance->Logs.Debug("SERIALIZE", "Loaded kv %s: %s", key.c_str(), out.c_str()); } return *this; } @@ -39,26 +39,26 @@ Serializable::Data& Serializable::Data::Load(const std::string& key, Serializabl ChildMap::iterator iter = this->children.find(key); if (iter == this->children.end()) { - ServerInstance->Logs.Log("SERIALIZE", LOG_DEBUG, "Unable to load missing data %s!", key.c_str()); + ServerInstance->Logs.Debug("SERIALIZE", "Unable to load missing data %s!", key.c_str()); } else { out = iter->second; - ServerInstance->Logs.Log("SERIALIZE", LOG_DEBUG, "Loaded data: %s", key.c_str()); + ServerInstance->Logs.Debug("SERIALIZE", "Loaded data: %s", key.c_str()); } return *this; } Serializable::Data& Serializable::Data::Store(const std::string& key, const std::string& value) { - ServerInstance->Logs.Log("SERIALIZE", LOG_DEBUG, "Stored kv %s: %s", key.c_str(), value.c_str()); + ServerInstance->Logs.Debug("SERIALIZE", "Stored kv %s: %s", key.c_str(), value.c_str()); this->entries[key] = value; return *this; } Serializable::Data& Serializable::Data::Store(const std::string& key, const Serializable::Data& value) { - ServerInstance->Logs.Log("SERIALIZE", LOG_DEBUG, "Stored data: %s", key.c_str()); + ServerInstance->Logs.Debug("SERIALIZE", "Stored data: %s", key.c_str()); this->children[key] = value; return *this; } @@ -78,7 +78,7 @@ bool Extensible::Deserialize(Serializable::Data& data) continue; } - ServerInstance->Logs.Log("SERIALIZE", LOG_DEBUG, "Tried to deserialize the %s extension item but it doesn't exist", + ServerInstance->Logs.Debug("SERIALIZE", "Tried to deserialize the %s extension item but it doesn't exist", name.c_str()); } return true; @@ -89,7 +89,7 @@ bool Extensible::Serialize(Serializable::Data& data) // If the extensible has been culled then it shouldn't be serialized. if (culled) { - ServerInstance->Logs.Log("SERIALIZE", LOG_DEBUG, "Tried to serialize an extensible which has been culled"); + ServerInstance->Logs.Debug("SERIALIZE", "Tried to serialize an extensible which has been culled"); return false; } @@ -107,7 +107,7 @@ bool User::Deserialize(Serializable::Data& data) // If the user is quitting they shouldn't be deserialized. if (quitting) { - ServerInstance->Logs.Log("SERIALIZE", LOG_DEBUG, "Tried to deserialize %s who is in the process of quitting", + ServerInstance->Logs.Debug("SERIALIZE", "Tried to deserialize %s who is in the process of quitting", uuid.c_str()); return false; } @@ -117,7 +117,7 @@ bool User::Deserialize(Serializable::Data& data) data.Load("uuid", client_uuid); if (!client_uuid.empty() && client_uuid != uuid) { - ServerInstance->Logs.Log("SERIALIZE", LOG_DEBUG, "Tried to deserialize %s into %s", + ServerInstance->Logs.Debug("SERIALIZE", "Tried to deserialize %s into %s", client_uuid.c_str(), uuid.c_str()); return false; } @@ -176,7 +176,7 @@ bool User::Serialize(Serializable::Data& data) // If the user is quitting they shouldn't be serialized. if (quitting) { - ServerInstance->Logs.Log("SERIALIZE", LOG_DEBUG, "Tried to serialize %s who is in the process of quitting", + ServerInstance->Logs.Debug("SERIALIZE", "Tried to serialize %s who is in the process of quitting", uuid.c_str()); return false; } diff --git a/src/snomasks.cpp b/src/snomasks.cpp index ddfabf683..ace0d2011 100644 --- a/src/snomasks.cpp +++ b/src/snomasks.cpp @@ -124,7 +124,7 @@ void Snomask::Flush() void Snomask::Send(char letter, const std::string& desc, const std::string& msg) { - ServerInstance->Logs.Log(desc, LOG_DEFAULT, msg); + ServerInstance->Logs.Normal(desc, msg); const std::string finalmsg = InspIRCd::Format("*** %s: %s", desc.c_str(), msg.c_str()); /* Only opers can receive snotices, so we iterate the oper list */ diff --git a/src/socket.cpp b/src/socket.cpp index e2a3d64be..9188f3fca 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -40,7 +40,7 @@ bool InspIRCd::BindPort(std::shared_ptr<ConfigTag> tag, const irc::sockets::sock if ((**n).bind_sa == sa) { // Replace tag, we know addr and port match, but other info (type, ssl) may not. - ServerInstance->Logs.Log("SOCKET", LOG_DEFAULT, "Replacing listener on %s from old tag at %s with new tag from %s", + ServerInstance->Logs.Normal("SOCKET", "Replacing listener on %s from old tag at %s with new tag from %s", sa.str().c_str(), (*n)->bind_tag->source.str().c_str(), tag->source.str().c_str()); (*n)->bind_tag = tag; (*n)->ResetIOHookProvider(); @@ -53,13 +53,13 @@ bool InspIRCd::BindPort(std::shared_ptr<ConfigTag> tag, const irc::sockets::sock ListenSocket* ll = new ListenSocket(tag, sa); if (!ll->HasFd()) { - ServerInstance->Logs.Log("SOCKET", LOG_DEFAULT, "Failed to listen on %s from tag at %s: %s", + ServerInstance->Logs.Normal("SOCKET", "Failed to listen on %s from tag at %s: %s", sa.str().c_str(), tag->source.str().c_str(), strerror(errno)); delete ll; return false; } - ServerInstance->Logs.Log("SOCKET", LOG_DEFAULT, "Added a listener on %s from tag at %s", sa.str().c_str(), tag->source.str().c_str()); + ServerInstance->Logs.Normal("SOCKET", "Added a listener on %s from tag at %s", sa.str().c_str(), tag->source.str().c_str()); ports.push_back(ll); return true; } @@ -78,11 +78,11 @@ size_t InspIRCd::BindPorts(FailedPortList& failed_ports) { // InspIRCd supports IPv4 and IPv6 natively; no 4in6 required. if (strncasecmp(address.c_str(), "::ffff:", 7) == 0) - this->Logs.Log("SOCKET", LOG_DEFAULT, "Using 4in6 (::ffff:) isn't recommended. You should bind IPv4 addresses directly instead."); + this->Logs.Normal("SOCKET", "Using 4in6 (::ffff:) isn't recommended. You should bind IPv4 addresses directly instead."); // A TCP listener with no ports is not very useful. if (portlist.empty()) - this->Logs.Log("SOCKET", LOG_DEFAULT, "TCP listener on %s at %s has no ports specified!", + this->Logs.Normal("SOCKET", "TCP listener on %s at %s has no ports specified!", address.empty() ? "*" : address.c_str(), tag->source.str().c_str()); irc::portparser portrange(portlist, false); @@ -111,7 +111,7 @@ size_t InspIRCd::BindPorts(FailedPortList& failed_ports) irc::sockets::sockaddrs bindspec; if (fullpath.length() > std::min(ServerInstance->Config->Limits.MaxHost, sizeof(bindspec.un.sun_path) - 1)) { - this->Logs.Log("SOCKET", LOG_DEFAULT, "UNIX listener on %s at %s specified a path that is too long!", + this->Logs.Normal("SOCKET", "UNIX listener on %s at %s specified a path that is too long!", fullpath.c_str(), tag->source.str().c_str()); continue; } @@ -119,7 +119,7 @@ size_t InspIRCd::BindPorts(FailedPortList& failed_ports) // Check for characters which are problematic in the IRC message format. if (fullpath.find_first_of("\n\r\t!@: ") != std::string::npos) { - this->Logs.Log("SOCKET", LOG_DEFAULT, "UNIX listener on %s at %s specified a path containing invalid characters!", + this->Logs.Normal("SOCKET", "UNIX listener on %s at %s specified a path containing invalid characters!", fullpath.c_str(), tag->source.str().c_str()); continue; } @@ -139,11 +139,11 @@ size_t InspIRCd::BindPorts(FailedPortList& failed_ports) n++; if (n == ports.end()) { - this->Logs.Log("SOCKET", LOG_DEFAULT, "Port bindings slipped out of vector, aborting close!"); + this->Logs.Normal("SOCKET", "Port bindings slipped out of vector, aborting close!"); break; } - this->Logs.Log("SOCKET", LOG_DEFAULT, "Port binding %s was removed from the config file, closing.", + this->Logs.Normal("SOCKET", "Port binding %s was removed from the config file, closing.", (**n).bind_sa.str().c_str()); delete *n; @@ -227,7 +227,7 @@ int irc::sockets::sockaddrs::port() const } // If we have reached this point then we have encountered a bug. - ServerInstance->Logs.Log("SOCKET", LOG_DEBUG, "BUG: irc::sockets::sockaddrs::port(): socket type %d is unknown!", family()); + ServerInstance->Logs.Debug("SOCKET", "BUG: irc::sockets::sockaddrs::port(): socket type %d is unknown!", family()); return 0; } @@ -252,7 +252,7 @@ std::string irc::sockets::sockaddrs::addr() const } // If we have reached this point then we have encountered a bug. - ServerInstance->Logs.Log("SOCKET", LOG_DEBUG, "BUG: irc::sockets::sockaddrs::addr(): socket type %d is unknown!", family()); + ServerInstance->Logs.Debug("SOCKET", "BUG: irc::sockets::sockaddrs::addr(): socket type %d is unknown!", family()); return "<unknown>"; } @@ -277,7 +277,7 @@ std::string irc::sockets::sockaddrs::str() const } // If we have reached this point then we have encountered a bug. - ServerInstance->Logs.Log("SOCKET", LOG_DEBUG, "BUG: irc::sockets::sockaddrs::str(): socket type %d is unknown!", family()); + ServerInstance->Logs.Debug("SOCKET", "BUG: irc::sockets::sockaddrs::str(): socket type %d is unknown!", family()); return "<unknown>"; } @@ -296,7 +296,7 @@ socklen_t irc::sockets::sockaddrs::sa_size() const } // If we have reached this point then we have encountered a bug. - ServerInstance->Logs.Log("SOCKET", LOG_DEBUG, "BUG: irc::sockets::sockaddrs::sa_size(): socket type %d is unknown!", family()); + ServerInstance->Logs.Debug("SOCKET", "BUG: irc::sockets::sockaddrs::sa_size(): socket type %d is unknown!", family()); return 0; } @@ -318,7 +318,7 @@ bool irc::sockets::sockaddrs::operator==(const irc::sockets::sockaddrs& other) c } // If we have reached this point then we have encountered a bug. - ServerInstance->Logs.Log("SOCKET", LOG_DEBUG, "BUG: irc::sockets::sockaddrs::operator==(): socket type %d is unknown!", family()); + ServerInstance->Logs.Debug("SOCKET", "BUG: irc::sockets::sockaddrs::operator==(): socket type %d is unknown!", family()); return !memcmp(this, &other, sizeof(*this)); } @@ -352,7 +352,7 @@ static void sa2cidr(irc::sockets::cidr_mask& cidr, const irc::sockets::sockaddrs default: // If we have reached this point then we have encountered a bug. - ServerInstance->Logs.Log("SOCKET", LOG_DEBUG, "BUG: sa2cidr(): socket type %d is unknown!", cidr.type); + ServerInstance->Logs.Debug("SOCKET", "BUG: sa2cidr(): socket type %d is unknown!", cidr.type); cidr.length = 0; return; } @@ -417,7 +417,7 @@ std::string irc::sockets::cidr_mask::str() const default: // If we have reached this point then we have encountered a bug. - ServerInstance->Logs.Log("SOCKET", LOG_DEBUG, "BUG: irc::sockets::cidr_mask::str(): socket type %d is unknown!", type); + ServerInstance->Logs.Debug("SOCKET", "BUG: irc::sockets::cidr_mask::str(): socket type %d is unknown!", type); return "<unknown>"; } diff --git a/src/socketengines/epoll.cpp b/src/socketengines/epoll.cpp index 727ca15ba..0f7da7edf 100644 --- a/src/socketengines/epoll.cpp +++ b/src/socketengines/epoll.cpp @@ -90,13 +90,13 @@ bool SocketEngine::AddFd(EventHandler* eh, int event_mask) int fd = eh->GetFd(); if (fd < 0) { - ServerInstance->Logs.Log("SOCKET", LOG_DEBUG, "AddFd out of range: (fd: %d)", fd); + ServerInstance->Logs.Debug("SOCKET", "AddFd out of range: (fd: %d)", fd); return false; } if (!SocketEngine::AddFdRef(eh)) { - ServerInstance->Logs.Log("SOCKET", LOG_DEBUG, "Attempt to add duplicate fd: %d", fd); + ServerInstance->Logs.Debug("SOCKET", "Attempt to add duplicate fd: %d", fd); return false; } @@ -107,11 +107,11 @@ bool SocketEngine::AddFd(EventHandler* eh, int event_mask) int i = epoll_ctl(EngineHandle, EPOLL_CTL_ADD, fd, &ev); if (i < 0) { - ServerInstance->Logs.Log("SOCKET", LOG_DEBUG, "Error adding fd: %d to socketengine: %s", fd, strerror(errno)); + ServerInstance->Logs.Debug("SOCKET", "Error adding fd: %d to socketengine: %s", fd, strerror(errno)); return false; } - ServerInstance->Logs.Log("SOCKET", LOG_DEBUG, "New file descriptor: %d", fd); + ServerInstance->Logs.Debug("SOCKET", "New file descriptor: %d", fd); eh->SetEventMask(event_mask); ResizeDouble(events); @@ -139,7 +139,7 @@ void SocketEngine::DelFd(EventHandler* eh) int fd = eh->GetFd(); if (fd < 0) { - ServerInstance->Logs.Log("SOCKET", LOG_DEBUG, "DelFd out of range: (fd: %d)", fd); + ServerInstance->Logs.Debug("SOCKET", "DelFd out of range: (fd: %d)", fd); return; } @@ -151,12 +151,12 @@ void SocketEngine::DelFd(EventHandler* eh) if (i < 0) { - ServerInstance->Logs.Log("SOCKET", LOG_DEBUG, "epoll_ctl can't remove socket: %s", strerror(errno)); + ServerInstance->Logs.Debug("SOCKET", "epoll_ctl can't remove socket: %s", strerror(errno)); } SocketEngine::DelFdRef(eh); - ServerInstance->Logs.Log("SOCKET", LOG_DEBUG, "Remove file descriptor: %d", fd); + ServerInstance->Logs.Debug("SOCKET", "Remove file descriptor: %d", fd); } int SocketEngine::DispatchEvents() diff --git a/src/socketengines/kqueue.cpp b/src/socketengines/kqueue.cpp index 6182fad5e..69b63f76b 100644 --- a/src/socketengines/kqueue.cpp +++ b/src/socketengines/kqueue.cpp @@ -108,7 +108,7 @@ bool SocketEngine::AddFd(EventHandler* eh, int event_mask) struct kevent* ke = GetChangeKE(); EV_SET(ke, fd, EVFILT_READ, EV_ADD, 0, 0, udata_cast(eh)); - ServerInstance->Logs.Log("SOCKET", LOG_DEBUG, "New file descriptor: %d", fd); + ServerInstance->Logs.Debug("SOCKET", "New file descriptor: %d", fd); eh->SetEventMask(event_mask); OnSetEvent(eh, 0, event_mask); @@ -123,7 +123,7 @@ void SocketEngine::DelFd(EventHandler* eh) if (fd < 0) { - ServerInstance->Logs.Log("SOCKET", LOG_DEFAULT, "DelFd() on invalid fd: %d", fd); + ServerInstance->Logs.Normal("SOCKET", "DelFd() on invalid fd: %d", fd); return; } @@ -138,7 +138,7 @@ void SocketEngine::DelFd(EventHandler* eh) SocketEngine::DelFdRef(eh); - ServerInstance->Logs.Log("SOCKET", LOG_DEBUG, "Remove file descriptor: %d", fd); + ServerInstance->Logs.Debug("SOCKET", "Remove file descriptor: %d", fd); } void SocketEngine::OnSetEvent(EventHandler* eh, int old_mask, int new_mask) diff --git a/src/socketengines/poll.cpp b/src/socketengines/poll.cpp index a86e772fa..7b00fcc6d 100644 --- a/src/socketengines/poll.cpp +++ b/src/socketengines/poll.cpp @@ -68,13 +68,13 @@ bool SocketEngine::AddFd(EventHandler* eh, int event_mask) int fd = eh->GetFd(); if (fd < 0) { - ServerInstance->Logs.Log("SOCKET", LOG_DEBUG, "AddFd out of range: (fd: %d)", fd); + ServerInstance->Logs.Debug("SOCKET", "AddFd out of range: (fd: %d)", fd); return false; } if (static_cast<unsigned int>(fd) < fd_mappings.size() && fd_mappings[fd] != -1) { - ServerInstance->Logs.Log("SOCKET", LOG_DEBUG, "Attempt to add duplicate fd: %d", fd); + ServerInstance->Logs.Debug("SOCKET", "Attempt to add duplicate fd: %d", fd); return false; } @@ -82,7 +82,7 @@ bool SocketEngine::AddFd(EventHandler* eh, int event_mask) if (!SocketEngine::AddFdRef(eh)) { - ServerInstance->Logs.Log("SOCKET", LOG_DEBUG, "Attempt to add duplicate fd: %d", fd); + ServerInstance->Logs.Debug("SOCKET", "Attempt to add duplicate fd: %d", fd); return false; } @@ -94,7 +94,7 @@ bool SocketEngine::AddFd(EventHandler* eh, int event_mask) events[index].fd = fd; events[index].events = mask_to_poll(event_mask); - ServerInstance->Logs.Log("SOCKET", LOG_DEBUG, "New file descriptor: %d (%d; index %d)", fd, events[index].events, index); + ServerInstance->Logs.Debug("SOCKET", "New file descriptor: %d (%d; index %d)", fd, events[index].events, index); eh->SetEventMask(event_mask); return true; } @@ -104,7 +104,7 @@ void SocketEngine::OnSetEvent(EventHandler* eh, int old_mask, int new_mask) int fd = eh->GetFd(); if (fd < 0 || static_cast<unsigned int>(fd) >= fd_mappings.size() || fd_mappings[fd] == -1) { - ServerInstance->Logs.Log("SOCKET", LOG_DEBUG, "SetEvents() on unknown fd: %d", eh->GetFd()); + ServerInstance->Logs.Debug("SOCKET", "SetEvents() on unknown fd: %d", eh->GetFd()); return; } @@ -116,13 +116,13 @@ void SocketEngine::DelFd(EventHandler* eh) int fd = eh->GetFd(); if (fd < 0) { - ServerInstance->Logs.Log("SOCKET", LOG_DEBUG, "DelFd out of range: (fd: %d)", fd); + ServerInstance->Logs.Debug("SOCKET", "DelFd out of range: (fd: %d)", fd); return; } if (static_cast<unsigned int>(fd) >= fd_mappings.size() || fd_mappings[fd] == -1) { - ServerInstance->Logs.Log("SOCKET", LOG_DEBUG, "DelFd() on unknown fd: %d", fd); + ServerInstance->Logs.Debug("SOCKET", "DelFd() on unknown fd: %d", fd); return; } @@ -150,7 +150,7 @@ void SocketEngine::DelFd(EventHandler* eh) SocketEngine::DelFdRef(eh); - ServerInstance->Logs.Log("SOCKET", LOG_DEBUG, "Remove file descriptor: %d (index: %d) " + ServerInstance->Logs.Debug("SOCKET", "Remove file descriptor: %d (index: %d) " "(Filled gap with: %d (index: %d))", fd, index, last_fd, last_index); } diff --git a/src/socketengines/select.cpp b/src/socketengines/select.cpp index cbf15f3dc..5f5c4173b 100644 --- a/src/socketengines/select.cpp +++ b/src/socketengines/select.cpp @@ -80,7 +80,7 @@ bool SocketEngine::AddFd(EventHandler* eh, int event_mask) if (fd > MaxFD) MaxFD = fd; - ServerInstance->Logs.Log("SOCKET", LOG_DEBUG, "New file descriptor: %d", fd); + ServerInstance->Logs.Debug("SOCKET", "New file descriptor: %d", fd); return true; } @@ -102,7 +102,7 @@ void SocketEngine::DelFd(EventHandler* eh) if (fd == MaxFD) --MaxFD; - ServerInstance->Logs.Log("SOCKET", LOG_DEBUG, "Remove file descriptor: %d", fd); + ServerInstance->Logs.Debug("SOCKET", "Remove file descriptor: %d", fd); } void SocketEngine::OnSetEvent(EventHandler* eh, int old_mask, int new_mask) diff --git a/src/usermanager.cpp b/src/usermanager.cpp index b30335367..83a0abd87 100644 --- a/src/usermanager.cpp +++ b/src/usermanager.cpp @@ -125,7 +125,7 @@ void UserManager::AddUser(int socket, ListenSocket* via, irc::sockets::sockaddrs LocalUser* const New = new LocalUser(socket, client, server); UserIOHandler* eh = &New->eh; - ServerInstance->Logs.Log("USERS", LOG_DEBUG, "New user fd: %d", socket); + ServerInstance->Logs.Debug("USERS", "New user fd: %d", socket); this->unregistered_count++; this->clientlist[New->nick] = New; @@ -135,7 +135,7 @@ void UserManager::AddUser(int socket, ListenSocket* via, irc::sockets::sockaddrs if (!SocketEngine::AddFd(eh, FD_WANT_FAST_READ | FD_WANT_EDGE_WRITE)) { - ServerInstance->Logs.Log("USERS", LOG_DEBUG, "Internal error on new connection"); + ServerInstance->Logs.Debug("USERS", "Internal error on new connection"); this->QuitUser(New, "Internal error handling connection"); return; } @@ -148,7 +148,7 @@ void UserManager::AddUser(int socket, ListenSocket* via, irc::sockets::sockaddrs { if (!iohookprovref.GetProvider().empty()) { - ServerInstance->Logs.Log("USERS", LOG_DEBUG, "Non-existent I/O hook '%s' in <bind:%s> tag at %s", + ServerInstance->Logs.Debug("USERS", "Non-existent I/O hook '%s' in <bind:%s> tag at %s", iohookprovref.GetProvider().c_str(), i == via->iohookprovs.begin() ? "hook" : "sslprofile", via->bind_tag->source.str().c_str()); @@ -196,7 +196,7 @@ void UserManager::AddUser(int socket, ListenSocket* via, irc::sockets::sockaddrs if (!b->Type.empty() && !New->exempt) { /* user banned */ - ServerInstance->Logs.Log("BANCACHE", LOG_DEBUG, "BanCache: Positive hit for " + New->GetIPString()); + ServerInstance->Logs.Debug("BANCACHE", "BanCache: Positive hit for " + New->GetIPString()); if (!ServerInstance->Config->XLineMessage.empty()) New->WriteNumeric(ERR_YOUREBANNEDCREEP, ServerInstance->Config->XLineMessage); @@ -208,7 +208,7 @@ void UserManager::AddUser(int socket, ListenSocket* via, irc::sockets::sockaddrs } else { - ServerInstance->Logs.Log("BANCACHE", LOG_DEBUG, "BanCache: Negative hit for " + New->GetIPString()); + ServerInstance->Logs.Debug("BANCACHE", "BanCache: Negative hit for " + New->GetIPString()); } } else @@ -237,13 +237,13 @@ void UserManager::QuitUser(User* user, const std::string& quitmessage, const std { if (user->quitting) { - ServerInstance->Logs.Log("USERS", LOG_DEFAULT, "ERROR: Tried to quit quitting user: " + user->nick); + ServerInstance->Logs.Normal("USERS", "ERROR: Tried to quit quitting user: " + user->nick); return; } if (IS_SERVER(user)) { - ServerInstance->Logs.Log("USERS", LOG_DEFAULT, "ERROR: Tried to quit server user: " + user->nick); + ServerInstance->Logs.Normal("USERS", "ERROR: Tried to quit server user: " + user->nick); return; } @@ -270,7 +270,7 @@ void UserManager::QuitUser(User* user, const std::string& quitmessage, const std operquitmsg.erase(ServerInstance->Config->Limits.MaxQuit + 1); user->quitting = true; - ServerInstance->Logs.Log("USERS", LOG_DEBUG, "QuitUser: %s=%s '%s'", user->uuid.c_str(), user->nick.c_str(), quitmessage.c_str()); + ServerInstance->Logs.Debug("USERS", "QuitUser: %s=%s '%s'", user->uuid.c_str(), user->nick.c_str(), quitmessage.c_str()); if (localuser) { ClientProtocol::Messages::Error errormsg(InspIRCd::Format("Closing link: (%s) [%s]", user->MakeHost().c_str(), operquitmsg.c_str())); @@ -299,7 +299,7 @@ void UserManager::QuitUser(User* user, const std::string& quitmessage, const std } if (!clientlist.erase(user->nick)) - ServerInstance->Logs.Log("USERS", LOG_DEFAULT, "ERROR: Nick not found in clientlist, cannot remove: " + user->nick); + ServerInstance->Logs.Normal("USERS", "ERROR: Nick not found in clientlist, cannot remove: " + user->nick); uuidlist.erase(user->uuid); user->PurgeEmptyChannels(); diff --git a/src/users.cpp b/src/users.cpp index e8e96aadd..1ec5f8abe 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -87,7 +87,7 @@ User::User(const std::string& uid, Server* srv, Type type) { client_sa.sa.sa_family = AF_UNSPEC; - ServerInstance->Logs.Log("USERS", LOG_DEBUG, "New UUID for user: %s", uuid.c_str()); + ServerInstance->Logs.Debug("USERS", "New UUID for user: %s", uuid.c_str()); if (srv->IsService()) ServerInstance->Users.all_services.push_back(this); @@ -418,7 +418,7 @@ namespace else if (ModeParser::IsModeChar(chr)) modeset.set(ModeParser::GetModeIndex(chr)); else - ServerInstance->Logs.Log("CONFIG", LOG_DEFAULT, "'%c' is not a valid value for <class:%s>, ignoring...", chr, field.c_str()); + ServerInstance->Logs.Normal("CONFIG", "'%c' is not a valid value for <class:%s>, ignoring...", chr, field.c_str()); } } } @@ -578,7 +578,7 @@ void LocalUser::FullConnect() ServerInstance->SNO.WriteToSnoMask('c',"Client connecting on port %d (class %s): %s (%s) [%s\x0F]", this->server_sa.port(), this->GetClass()->name.c_str(), GetFullRealHost().c_str(), this->GetIPString().c_str(), this->GetRealName().c_str()); - ServerInstance->Logs.Log("BANCACHE", LOG_DEBUG, "BanCache: Adding NEGATIVE hit for " + this->GetIPString()); + ServerInstance->Logs.Debug("BANCACHE", "BanCache: Adding NEGATIVE hit for " + this->GetIPString()); ServerInstance->BanCache.AddHit(this->GetIPString(), "", ""); // reset the flood penalty (which could have been raised due to things like auto +x) CommandFloodPenalty = 0; @@ -598,7 +598,7 @@ bool User::ChangeNick(const std::string& newnick, time_t newts) { if (quitting) { - ServerInstance->Logs.Log("USERS", LOG_DEFAULT, "ERROR: Attempted to change nick of a quitting user: " + this->nick); + ServerInstance->Logs.Normal("USERS", "ERROR: Attempted to change nick of a quitting user: " + this->nick); return false; } @@ -792,7 +792,7 @@ void LocalUser::Write(const ClientProtocol::SerializedMessage& text) if (nlpos == std::string::npos) nlpos = text.length(); // TODO is this ok, test it - ServerInstance->Logs.Log("USEROUTPUT", LOG_RAWIO, "C[%s] O %.*s", uuid.c_str(), static_cast<int>(nlpos), text.c_str()); + ServerInstance->Logs.RawIO("USEROUTPUT", "C[%s] O %.*s", uuid.c_str(), static_cast<int>(nlpos), text.c_str()); } eh.AddWriteBuf(text); @@ -807,7 +807,7 @@ void LocalUser::Send(ClientProtocol::Event& protoev) { if (!serializer) { - ServerInstance->Logs.Log("USERS", LOG_DEBUG, "BUG: LocalUser::Send() called on %s who does not have a serializer!", + ServerInstance->Logs.Debug("USERS", "BUG: LocalUser::Send() called on %s who does not have a serializer!", GetFullRealHost().c_str()); return; } @@ -1080,7 +1080,7 @@ bool User::ChangeIdent(const std::string& newident) */ void LocalUser::SetClass(const std::string &explicit_name) { - ServerInstance->Logs.Log("CONNECTCLASS", LOG_DEBUG, "Setting connect class for %s (%s) ...", + ServerInstance->Logs.Debug("CONNECTCLASS", "Setting connect class for %s (%s) ...", this->uuid.c_str(), this->GetFullRealHost().c_str()); ConnectClass::Ptr found; @@ -1090,7 +1090,7 @@ void LocalUser::SetClass(const std::string &explicit_name) { if (explicit_name == c->name) { - ServerInstance->Logs.Log("CONNECTCLASS", LOG_DEBUG, "Connect class explicitly set to %s", + ServerInstance->Logs.Debug("CONNECTCLASS", "Connect class explicitly set to %s", explicit_name.c_str()); found = c; } @@ -1100,7 +1100,7 @@ void LocalUser::SetClass(const std::string &explicit_name) { for (const auto& c : ServerInstance->Config->Classes) { - ServerInstance->Logs.Log("CONNECTCLASS", LOG_DEBUG, "Checking the %s connect class ...", + ServerInstance->Logs.Debug("CONNECTCLASS", "Checking the %s connect class ...", c->GetName().c_str()); ModResult MOD_RESULT; @@ -1110,7 +1110,7 @@ void LocalUser::SetClass(const std::string &explicit_name) if (MOD_RESULT == MOD_RES_ALLOW) { - ServerInstance->Logs.Log("CONNECTCLASS", LOG_DEBUG, "The %s connect class was explicitly chosen by a module", + ServerInstance->Logs.Debug("CONNECTCLASS", "The %s connect class was explicitly chosen by a module", c->GetName().c_str()); found = c; break; @@ -1118,7 +1118,7 @@ void LocalUser::SetClass(const std::string &explicit_name) if (c->type == ConnectClass::NAMED) { - ServerInstance->Logs.Log("CONNECTCLASS", LOG_DEBUG, "The %s connect class is not suitable as neither <connect:allow> nor <connect:deny> are set", + ServerInstance->Logs.Debug("CONNECTCLASS", "The %s connect class is not suitable as neither <connect:allow> nor <connect:deny> are set", c->GetName().c_str()); continue; } @@ -1126,7 +1126,7 @@ void LocalUser::SetClass(const std::string &explicit_name) bool regdone = (registered != REG_NONE); if (c->config->getBool("registered", regdone) != regdone) { - ServerInstance->Logs.Log("CONNECTCLASS", LOG_DEBUG, "The %s connect class is not suitable as it requires that the user is %s", + ServerInstance->Logs.Debug("CONNECTCLASS", "The %s connect class is not suitable as it requires that the user is %s", c->GetName().c_str(), regdone ? "not fully connected" : "fully connected"); continue; } @@ -1143,7 +1143,7 @@ void LocalUser::SetClass(const std::string &explicit_name) if (!hostmatches) { const std::string hosts = stdalgo::string::join(c->GetHosts()); - ServerInstance->Logs.Log("CONNECTCLASS", LOG_DEBUG, "The %s connect class is not suitable as neither the host (%s) nor the IP (%s) matches %s", + ServerInstance->Logs.Debug("CONNECTCLASS", "The %s connect class is not suitable as neither the host (%s) nor the IP (%s) matches %s", c->GetName().c_str(), this->GetRealHost().c_str(), this->GetIPString().c_str(), hosts.c_str()); continue; } @@ -1155,7 +1155,7 @@ void LocalUser::SetClass(const std::string &explicit_name) if (c->limit && (c.use_count() >= static_cast<long>(c->limit))) { // HACK: using use_count() is awful and should be removed before v4 is released. - ServerInstance->Logs.Log("CONNECTCLASS", LOG_DEBUG, "The %s connect class is not suitable as it has reached its user limit (%lu)", + ServerInstance->Logs.Debug("CONNECTCLASS", "The %s connect class is not suitable as it has reached its user limit (%lu)", c->GetName().c_str(), c->limit); continue; } @@ -1163,20 +1163,20 @@ void LocalUser::SetClass(const std::string &explicit_name) /* if it requires a port and our port doesn't match, fail */ if (!c->ports.empty() && !c->ports.count(this->server_sa.port())) { - ServerInstance->Logs.Log("CONNECTCLASS", LOG_DEBUG, "The %s connect class is not suitable as the connection port (%d) is not any of %s", + ServerInstance->Logs.Debug("CONNECTCLASS", "The %s connect class is not suitable as the connection port (%d) is not any of %s", c->GetName().c_str(), this->server_sa.port(), stdalgo::string::join(c->ports).c_str()); continue; } if (regdone && !c->password.empty() && !ServerInstance->PassCompare(this, c->password, password, c->passwordhash)) { - ServerInstance->Logs.Log("CONNECTCLASS", LOG_DEBUG, "The %s connect class is not suitable as requires a password and %s", + ServerInstance->Logs.Debug("CONNECTCLASS", "The %s connect class is not suitable as requires a password and %s", c->GetName().c_str(), password.empty() ? "one was not provided" : "the provided password was incorrect"); continue; } /* we stop at the first class that meets ALL criteria. */ - ServerInstance->Logs.Log("CONNECTCLASS", LOG_DEBUG, "The %s connect class is suitable for %s (%s)", + ServerInstance->Logs.Debug("CONNECTCLASS", "The %s connect class is suitable for %s (%s)", c->GetName().c_str(), this->uuid.c_str(), this->GetFullRealHost().c_str()); found = c; break; @@ -1272,7 +1272,7 @@ void ConnectClass::Configure(const std::string& classname, std::shared_ptr<Confi passwordhash = tag->getString("hash", passwordhash); if (!password.empty() && (passwordhash.empty() || stdalgo::string::equalsci(passwordhash, "plaintext"))) { - ServerInstance->Logs.Log("CONNECTCLASS", LOG_DEFAULT, "<connect> tag '%s' at %s contains an plain text password, this is insecure!", + ServerInstance->Logs.Normal("CONNECTCLASS", "<connect> tag '%s' at %s contains an plain text password, this is insecure!", name.c_str(), tag->source.str().c_str()); } @@ -1299,7 +1299,7 @@ void ConnectClass::Configure(const std::string& classname, std::shared_ptr<Confi void ConnectClass::Update(const ConnectClass::Ptr src) { - ServerInstance->Logs.Log("CONNECTCLASS", LOG_DEBUG, "Updating %s from %s", name.c_str(), src->name.c_str()); + ServerInstance->Logs.Debug("CONNECTCLASS", "Updating %s from %s", name.c_str(), src->name.c_str()); commandrate = src->commandrate; config = src->config; fakelag = src->fakelag; diff --git a/src/xline.cpp b/src/xline.cpp index 788417cf4..e8b2f2b6a 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -562,7 +562,7 @@ void XLine::DefaultApply(User* u, const std::string &line, bool bancache) if (bancache) { - ServerInstance->Logs.Log("BANCACHE", LOG_DEBUG, "BanCache: Adding positive hit (" + line + ") for " + u->GetIPString()); + ServerInstance->Logs.Debug("BANCACHE", "BanCache: Adding positive hit (" + line + ") for " + u->GetIPString()); ServerInstance->BanCache.AddHit(u->GetIPString(), this->type, banReason, (this->duration > 0 ? (this->expiry - ServerInstance->Time()) : 0)); } } |
