diff options
84 files changed, 350 insertions, 350 deletions
diff --git a/include/logger.h b/include/logger.h index 5d4a80d9f..89cef7bf6 100644 --- a/include/logger.h +++ b/include/logger.h @@ -118,7 +118,7 @@ class CoreExport LogStream : public classbase typedef std::map<FileWriter*, int> FileLogMap; -class CoreExport LogManager : public fakederef<LogManager> +class CoreExport LogManager { private: /** Lock variable, set to true when a log is in progress, which prevents further loggging from happening and creating a loop. diff --git a/include/modules.h b/include/modules.h index c9ddde575..b93a575e7 100644 --- a/include/modules.h +++ b/include/modules.h @@ -125,7 +125,7 @@ struct ModResult { } \ catch (CoreException& modexcept) \ { \ - ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, "Exception caught: " + modexcept.GetReason()); \ + ServerInstance->Logs.Log("MODULE", LOG_DEFAULT, "Exception caught: " + modexcept.GetReason()); \ } \ } \ } while (0); @@ -150,7 +150,7 @@ do { \ } \ catch (CoreException& except_ ## n) \ { \ - ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, "Exception caught: " + (except_ ## n).GetReason()); \ + ServerInstance->Logs.Log("MODULE", LOG_DEFAULT, "Exception caught: " + (except_ ## n).GetReason()); \ } \ } \ } while(0) diff --git a/src/bancache.cpp b/src/bancache.cpp index 13e4dc7c7..837711d8c 100644 --- a/src/bancache.cpp +++ b/src/bancache.cpp @@ -55,7 +55,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.Log("BANCACHE", LOG_DEBUG, "Hit on " + it->first + " is out of date, removing!"); delete it->second; it = BanHash.erase(it); return true; @@ -64,9 +64,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.Log("BANCACHE", LOG_DEBUG, "BanCacheManager::RemoveEntries(): Removing positive hits for " + type); else - ServerInstance->Logs->Log("BANCACHE", LOG_DEBUG, "BanCacheManager::RemoveEntries(): Removing all negative hits"); + ServerInstance->Logs.Log("BANCACHE", LOG_DEBUG, "BanCacheManager::RemoveEntries(): Removing all negative hits"); for (BanCacheHash::iterator i = BanHash.begin(); i != BanHash.end(); ) { @@ -90,7 +90,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.Log("BANCACHE", LOG_DEBUG, "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 8749aee8e..12162f7cf 100644 --- a/src/base.cpp +++ b/src/base.cpp @@ -30,17 +30,17 @@ classbase::classbase() { if (ServerInstance) - ServerInstance->Logs->Log("CULLLIST", LOG_DEBUG, "classbase::+ @%p", (void*)this); + ServerInstance->Logs.Log("CULLLIST", LOG_DEBUG, "classbase::+ @%p", (void*)this); } CullResult classbase::cull() { if (ServerInstance) #ifdef INSPIRCD_ENABLE_RTTI - ServerInstance->Logs->Log("CULLLIST", LOG_DEBUG, "classbase::-%s @%p", + ServerInstance->Logs.Log("CULLLIST", LOG_DEBUG, "classbase::-%s @%p", typeid(*this).name(), (void*)this); #else - ServerInstance->Logs->Log("CULLLIST", LOG_DEBUG, "classbase::- @%p", (void*)this); + ServerInstance->Logs.Log("CULLLIST", LOG_DEBUG, "classbase::- @%p", (void*)this); #endif return CullResult(); } @@ -48,7 +48,7 @@ CullResult classbase::cull() classbase::~classbase() { if (ServerInstance) - ServerInstance->Logs->Log("CULLLIST", LOG_DEBUG, "classbase::~ @%p", (void*)this); + ServerInstance->Logs.Log("CULLLIST", LOG_DEBUG, "classbase::~ @%p", (void*)this); } CullResult::CullResult() @@ -80,14 +80,14 @@ refcountbase::refcountbase() : refcount(0) refcountbase::~refcountbase() { if (refcount && ServerInstance) - ServerInstance->Logs->Log("CULLLIST", LOG_DEBUG, "refcountbase::~ @%p with refcount %d", + ServerInstance->Logs.Log("CULLLIST", LOG_DEBUG, "refcountbase::~ @%p with refcount %d", (void*)this, refcount); } usecountbase::~usecountbase() { if (usecount && ServerInstance) - ServerInstance->Logs->Log("CULLLIST", LOG_DEBUG, "usecountbase::~ @%p with refcount %d", + ServerInstance->Logs.Log("CULLLIST", LOG_DEBUG, "usecountbase::~ @%p with refcount %d", (void*)this, usecount); } @@ -216,7 +216,7 @@ void Extensible::FreeAllExtItems() Extensible::~Extensible() { if ((!extensions.empty() || !culled) && ServerInstance) - ServerInstance->Logs->Log("CULLLIST", LOG_DEBUG, "Extensible destructor called without cull @%p", (void*)this); + ServerInstance->Logs.Log("CULLLIST", LOG_DEBUG, "Extensible destructor called without cull @%p", (void*)this); } LocalExtItem::LocalExtItem(const std::string& Key, ExtensibleType exttype, Module* mod) diff --git a/src/channels.cpp b/src/channels.cpp index 4f290f47f..172862869 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -121,7 +121,7 @@ Membership* Channel::GetUser(User* user) void Channel::SetDefaultModes() { - ServerInstance->Logs->Log("CHANNELS", LOG_DEBUG, "SetDefaultModes %s", + ServerInstance->Logs.Log("CHANNELS", LOG_DEBUG, "SetDefaultModes %s", ServerInstance->Config->DefaultModes.c_str()); irc::spacesepstream list(ServerInstance->Config->DefaultModes); std::string modeseq; @@ -163,7 +163,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.Log("CHANNELS", LOG_DEBUG, "Attempted to join unregistered user " + user->uuid + " to channel " + cname); return NULL; } @@ -256,7 +256,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.Log("CHANNELS", LOG_DEBUG, "Attempted to join server user " + user->uuid + " to channel " + this->name); return NULL; } diff --git a/src/commands.cpp b/src/commands.cpp index c5b34c72f..002428840 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -37,7 +37,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 %d in command (uuid=%s)!", + ServerInstance->Logs.Log("COMMAND", LOG_DEFAULT, "Unknown user type %d in command (uuid=%s)!", user->usertype, user->uuid.c_str()); return CMD_INVALID; } diff --git a/src/configparser.cpp b/src/configparser.cpp index ffd2d06cc..e26523396 100644 --- a/src/configparser.cpp +++ b/src/configparser.cpp @@ -415,7 +415,7 @@ void ParseStack::DoReadFile(const std::string& key, const std::string& name, int bool ParseStack::ParseFile(const std::string& path, int flags, const std::string& mandatory_tag, bool isexec) { - ServerInstance->Logs->Log("CONFIG", LOG_DEBUG, "Reading (isexec=%d) %s", isexec, path.c_str()); + ServerInstance->Logs.Log("CONFIG", LOG_DEBUG, "Reading (isexec=%d) %s", isexec, path.c_str()); if (stdalgo::isin(reading, path)) throw CoreException((isexec ? "Executable " : "File ") + path + " is included recursively (looped inclusion)"); @@ -441,7 +441,7 @@ bool ConfigTag::readString(const std::string& key, std::string& value, bool allo value = j->second; if (!allow_lf && (value.find('\n') != std::string::npos)) { - ServerInstance->Logs->Log("CONFIG", LOG_DEFAULT, "Value of <" + tag + ":" + key + "> at " + getTagLocation() + + ServerInstance->Logs.Log("CONFIG", LOG_DEFAULT, "Value of <" + tag + ":" + key + "> at " + getTagLocation() + " contains a linefeed, and linefeeds in this value are not permitted -- stripped to spaces."); for (std::string::iterator n = value.begin(); n != value.end(); n++) if (*n == '\n') @@ -460,7 +460,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.Log("CONFIG", LOG_DEFAULT, "WARNING: The value of <%s:%s> is not valid; value set to %s.", tag.c_str(), key.c_str(), def.c_str()); return def; } @@ -475,7 +475,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.Log("CONFIG", LOG_DEFAULT, "WARNING: The length of <%s:%s> is not between %ld and %ld; value set to %s.", tag.c_str(), key.c_str(), minlen, maxlen, def.c_str()); return def; } @@ -518,7 +518,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.Log("CONFIG", LOG_DEFAULT, message); num = def; } @@ -539,7 +539,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.Log("CONFIG", LOG_DEFAULT, message); num = def; } } @@ -587,7 +587,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 <" + tag + ":" + key + "> at " + getTagLocation() + + ServerInstance->Logs.Log("CONFIG", LOG_DEFAULT, "Value of <" + tag + ":" + key + "> at " + getTagLocation() + " is not a duration; value set to " + ConvToStr(def) + "."); return def; } @@ -618,7 +618,7 @@ bool ConfigTag::getBool(const std::string &key, bool def) if (result == "no" || result == "false" || result == "0" || result == "off") return false; - ServerInstance->Logs->Log("CONFIG", LOG_DEFAULT, "Value of <" + tag + ":" + key + "> at " + getTagLocation() + + ServerInstance->Logs.Log("CONFIG", LOG_DEFAULT, "Value of <" + tag + ":" + key + "> at " + getTagLocation() + " is not valid, ignoring"); return def; } diff --git a/src/configreader.cpp b/src/configreader.cpp index e1c588283..7579ac771 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -484,7 +484,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.Log("CONFIG", LOG_DEFAULT, "There were errors in your configuration file:"); Classes.clear(); } @@ -606,7 +606,7 @@ ConfigTag* ServerConfig::ConfValue(const std::string &tag) ConfigTag* rv = found.first->second; found.first++; if (found.first != found.second) - ServerInstance->Logs->Log("CONFIG", LOG_DEFAULT, "Multiple <" + tag + "> tags found; only first will be used " + ServerInstance->Logs.Log("CONFIG", LOG_DEFAULT, "Multiple <" + tag + "> tags found; only first will be used " "(first at " + rv->getTagLocation() + "; second at " + found.first->second->getTagLocation() + ")"); return rv; } @@ -649,7 +649,7 @@ void ConfigReaderThread::Run() void ConfigReaderThread::Finish() { ServerConfig* old = ServerInstance->Config; - ServerInstance->Logs->Log("CONFIG", LOG_DEBUG, "Switching to new configuration..."); + ServerInstance->Logs.Log("CONFIG", LOG_DEBUG, "Switching to new configuration..."); ServerInstance->Config = this->Config; Config->Apply(old, TheUserUID); @@ -672,12 +672,12 @@ void ConfigReaderThread::Finish() { try { - ServerInstance->Logs->Log("MODULE", LOG_DEBUG, "Rehashing " + i->first); + ServerInstance->Logs.Log("MODULE", LOG_DEBUG, "Rehashing " + i->first); i->second->ReadConfig(status); } catch (CoreException& modex) { - ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, "Exception caught: " + modex.GetReason()); + ServerInstance->Logs.Log("MODULE", LOG_DEFAULT, "Exception caught: " + modex.GetReason()); if (user) user->WriteNotice(i->first + ": " + modex.GetReason()); } @@ -688,8 +688,8 @@ void ConfigReaderThread::Finish() ServerInstance->ISupport.Build(); - ServerInstance->Logs->CloseLogs(); - ServerInstance->Logs->OpenFileLogs(); + ServerInstance->Logs.CloseLogs(); + ServerInstance->Logs.OpenFileLogs(); if (Config->RawLog && !old->RawLog) ServerInstance->Users->ServerNoticeAll("*** Raw I/O logging is enabled on this server. All messages, passwords, and commands are being recorded."); diff --git a/src/coremods/core_channel/cmd_kick.cpp b/src/coremods/core_channel/cmd_kick.cpp index 755c6613b..b35987108 100644 --- a/src/coremods/core_channel/cmd_kick.cpp +++ b/src/coremods/core_channel/cmd_kick.cpp @@ -84,7 +84,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.Log(MODNAME, LOG_DEBUG, "Dropped KICK due to membership id mismatch: " + ConvToStr(memb->id) + " != " + parameters[2]); return CMD_FAILURE; } } diff --git a/src/coremods/core_channel/core_channel.cpp b/src/coremods/core_channel/core_channel.cpp index 79de73773..06fc713b6 100644 --- a/src/coremods/core_channel/core_channel.cpp +++ b/src/coremods/core_channel/core_channel.cpp @@ -161,7 +161,7 @@ class CoreModChannel : public Module, public CheckExemption::EventListener 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.Log(MODNAME, LOG_DEBUG, "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 61e0d2650..60119a9ce 100644 --- a/src/coremods/core_channel/invite.cpp +++ b/src/coremods/core_channel/invite.cpp @@ -94,7 +94,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", user->uuid.c_str(), chan->name.c_str(), (unsigned long)timeout); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Invite::APIImpl::Create(): user=%s chan=%s timeout=%lu", user->uuid.c_str(), chan->name.c_str(), (unsigned long)timeout); Invite* inv = Find(user, chan); if (inv) @@ -103,7 +103,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", (void*) inv); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Invite::APIImpl::Create(): changing expiration in %p", (void*) inv); if (timeout == 0) { // Convert timed invite to non-expiring @@ -127,7 +127,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", (void*) inv); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Invite::APIImpl::Create(): created new Invite %p", (void*) inv); } } @@ -176,7 +176,7 @@ Invite::Invite::Invite(LocalUser* u, Channel* c) Invite::Invite::~Invite() { delete expiretimer; - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Invite::~ %p", (void*) this); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Invite::~ %p", (void*) this); } void Invite::Invite::Serialize(SerializeFormat format, bool show_chans, std::string& out) @@ -202,7 +202,7 @@ InviteExpireTimer::InviteExpireTimer(Invite::Invite* invite, time_t timeout) bool InviteExpireTimer::Tick(time_t currtime) { - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "InviteExpireTimer::Tick(): expired %p", (void*) inv); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "InviteExpireTimer::Tick(): expired %p", (void*) inv); apiimpl->Destruct(inv); return false; } diff --git a/src/coremods/core_dns.cpp b/src/coremods/core_dns.cpp index 8ec97b980..e3fd80686 100644 --- a/src/coremods/core_dns.cpp +++ b/src/coremods/core_dns.cpp @@ -45,7 +45,7 @@ class Packet : public Query if (pos + name.length() + 2 > output_size) throw Exception("Unable to pack name"); - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Packing name " + name); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Packing name " + name); irc::sepstream sep(name, '.'); std::string token; @@ -116,7 +116,7 @@ class Packet : public Query if (name.empty()) throw Exception("Unable to unpack name - no name"); - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Unpack name " + name); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Unpack name " + name); return name; } @@ -213,7 +213,7 @@ class Packet : public Query } if (!record.name.empty() && !record.rdata.empty()) - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, record.name + " -> " + record.rdata); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, record.name + " -> " + record.rdata); return record; } @@ -257,7 +257,7 @@ class Packet : public Query 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.Log(MODNAME, LOG_DEBUG, "qdcount: " + ConvToStr(qdcount) + " ancount: " + ConvToStr(ancount) + " nscount: " + ConvToStr(nscount) + " arcount: " + ConvToStr(arcount)); if (qdcount != 1) throw Exception("Question count != 1 in incoming packet"); @@ -363,7 +363,7 @@ class MyManager : public Manager, public Timer, public EventHandler */ bool CheckCache(DNS::Request* req, const DNS::Question& question) { - ServerInstance->Logs->Log(MODNAME, LOG_SPARSE, "cache: Checking cache for " + question.name); + ServerInstance->Logs.Log(MODNAME, LOG_SPARSE, "cache: Checking cache for " + question.name); cache_map::iterator it = this->cache.find(question); if (it == this->cache.end()) @@ -376,7 +376,7 @@ class MyManager : public Manager, public Timer, public EventHandler return false; } - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "cache: Using cached result for " + question.name); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "cache: Using cached result for " + question.name); record.cached = true; req->OnLookupComplete(&record); return true; @@ -403,7 +403,7 @@ class MyManager : public Manager, public Timer, public EventHandler 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.Log(MODNAME, LOG_DEBUG, "cache: added cache for " + rr.name + " -> " + rr.rdata + " ttl: " + ConvToStr(rr.ttl)); this->cache[r.question] = r; } @@ -442,7 +442,7 @@ class MyManager : public Manager, public Timer, public EventHandler if ((unloading) || (req->creator->dying)) throw Exception("Module is being unloaded"); - 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.Log(MODNAME, LOG_DEBUG, "Processing request to lookup " + req->question.name + " of type " + ConvToStr(req->question.type) + " to " + this->myserver.addr()); /* Create an id */ unsigned int tries = 0; @@ -489,7 +489,7 @@ class MyManager : public Manager, public Timer, public EventHandler */ if (req->use_cache && this->CheckCache(req, p.question)) { - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Using cached result"); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Using cached result"); delete req; return; } @@ -540,7 +540,7 @@ class MyManager : public Manager, public Timer, public EventHandler void OnEventHandlerError(int errcode) override { - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "UDP socket got an error event"); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "UDP socket got an error event"); } void OnEventHandlerRead() override @@ -558,7 +558,7 @@ class MyManager : public Manager, public Timer, public EventHandler { 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.Log(MODNAME, LOG_DEBUG, "Got a result from the wrong server! Bad NAT or DNS forging attempt? '%s' != '%s'", server1.c_str(), server2.c_str()); return; } @@ -573,21 +573,21 @@ class MyManager : public Manager, public Timer, public EventHandler } catch (Exception& ex) { - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, ex.GetReason()); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, ex.GetReason()); } // recv_packet.id must be filled in here DNS::Request* request = this->requests[recv_packet.id]; if (request == NULL) { - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Received an answer for something we didn't request"); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "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.Log(MODNAME, LOG_DEBUG, "Received an answer that isn't for a question we asked"); return; } @@ -599,7 +599,7 @@ class MyManager : public Manager, public Timer, public EventHandler } else if (recv_packet.flags & QUERYFLAGS_OPCODE) { - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Received a nonstandard query"); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Received a nonstandard query"); ServerInstance->stats.DnsBad++; recv_packet.error = ERROR_NONSTANDARD_QUERY; request->OnError(&recv_packet); @@ -611,23 +611,23 @@ class MyManager : public Manager, public Timer, public EventHandler switch (recv_packet.flags & QUERYFLAGS_RCODE) { case 1: - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "format error"); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "format error"); error = ERROR_FORMAT_ERROR; break; case 2: - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "server error"); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "server error"); error = ERROR_SERVER_FAILURE; break; case 3: - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "domain not found"); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "domain not found"); error = ERROR_DOMAIN_NOT_FOUND; break; case 4: - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "not implemented"); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "not implemented"); error = ERROR_NOT_IMPLEMENTED; break; case 5: - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "refused"); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "refused"); error = ERROR_REFUSED; break; default: @@ -640,14 +640,14 @@ class MyManager : public Manager, public Timer, public EventHandler } else if (recv_packet.answers.empty()) { - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "No resource records returned"); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "No resource records returned"); ServerInstance->stats.DnsBad++; 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.Log(MODNAME, LOG_DEBUG, "Lookup complete for " + request->question.name); ServerInstance->stats.DnsGood++; request->OnLookupComplete(&recv_packet); this->AddCache(recv_packet); @@ -661,7 +661,7 @@ class MyManager : public Manager, public Timer, public EventHandler bool Tick(time_t now) override { - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "cache: purging DNS cache"); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "cache: purging DNS cache"); for (cache_map::iterator it = this->cache.begin(); it != this->cache.end(); ) { @@ -711,23 +711,23 @@ class MyManager : public Manager, public Timer, public EventHandler 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.Log(MODNAME, LOG_SPARSE, "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.Log(MODNAME, LOG_SPARSE, "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.Log(MODNAME, LOG_SPARSE, "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.Log(MODNAME, LOG_SPARSE, "Error creating DNS socket - hostnames will NOT resolve"); } } }; @@ -743,7 +743,7 @@ class ModuleDNS : public Module { #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.Log(MODNAME, LOG_DEFAULT, "WARNING: <dns:server> not defined, attempting to find a working server in the system settings..."); PFIXED_INFO pFixedInfo; DWORD dwBufferSize = sizeof(FIXED_INFO); @@ -767,15 +767,15 @@ class ModuleDNS : public Module 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.Log(MODNAME, LOG_DEFAULT, "<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.Log(MODNAME, LOG_DEFAULT, "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.Log(MODNAME, LOG_DEFAULT, "WARNING: <dns:server> not defined, attempting to find working server in /etc/resolv.conf..."); std::ifstream resolv("/etc/resolv.conf"); @@ -786,13 +786,13 @@ class ModuleDNS : public Module 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.Log(MODNAME, LOG_DEFAULT, "<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.Log(MODNAME, LOG_DEFAULT, "/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 d8d19d890..72ff302e3 100644 --- a/src/coremods/core_hostname_lookup.cpp +++ b/src/coremods/core_hostname_lookup.cpp @@ -61,7 +61,7 @@ class UserResolver : public DNS::Request LocalUser* bound_user = (LocalUser*)ServerInstance->FindUUID(uuid); if (!bound_user) { - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Resolution finished for user '%s' who is gone", uuid.c_str()); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Resolution finished for user '%s' who is gone", uuid.c_str()); return; } @@ -72,7 +72,7 @@ class UserResolver : public DNS::Request return; } - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "DNS result for %s: '%s' -> '%s'", uuid.c_str(), ans_record->name.c_str(), ans_record->rdata.c_str()); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "DNS result for %s: '%s' -> '%s'", uuid.c_str(), ans_record->name.c_str(), ans_record->rdata.c_str()); if (!fwd) { @@ -97,7 +97,7 @@ class UserResolver : public DNS::Request catch (DNS::Exception& e) { delete res_forward; - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Error in resolver: " + e.GetReason()); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Error in resolver: " + e.GetReason()); bound_user->WriteNotice("*** There was an internal error resolving your host, using your IP address (" + bound_user->GetIPString() + ") instead."); dl->set(bound_user, 0); @@ -134,7 +134,7 @@ class UserResolver : public DNS::Request if (hostname == NULL) { - ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "ERROR: User has no hostname attached when doing a forward lookup"); + ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "ERROR: User has no hostname attached when doing a forward lookup"); bound_user->WriteNotice("*** There was an internal error resolving your host, using your IP address (" + bound_user->GetIPString() + ") instead."); return; } @@ -217,7 +217,7 @@ class ModuleHostnameLookup : public Module { this->dnsLookup.set(user, 0); delete res_reverse; - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Error in resolver: " + e.GetReason()); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Error in resolver: " + e.GetReason()); } } diff --git a/src/coremods/core_oper/cmd_die.cpp b/src/coremods/core_oper/cmd_die.cpp index 5a366bf76..3402dc1f8 100644 --- a/src/coremods/core_oper/cmd_die.cpp +++ b/src/coremods/core_oper/cmd_die.cpp @@ -65,7 +65,7 @@ CmdResult CommandDie::Handle(User* user, const Params& parameters) { { std::string diebuf = "*** DIE command from " + user->GetFullHost() + ". Terminating."; - ServerInstance->Logs->Log(MODNAME, LOG_SPARSE, diebuf); + ServerInstance->Logs.Log(MODNAME, LOG_SPARSE, diebuf); DieRestart::SendError(diebuf); } @@ -74,7 +74,7 @@ CmdResult CommandDie::Handle(User* user, const Params& parameters) } else { - ServerInstance->Logs->Log(MODNAME, LOG_SPARSE, "Failed /DIE command from %s", user->GetFullRealHost().c_str()); + ServerInstance->Logs.Log(MODNAME, LOG_SPARSE, "Failed /DIE command from %s", user->GetFullRealHost().c_str()); ServerInstance->SNO->WriteGlobalSno('a', "Failed DIE Command from %s.", user->GetFullRealHost().c_str()); return CMD_FAILURE; } diff --git a/src/coremods/core_oper/cmd_restart.cpp b/src/coremods/core_oper/cmd_restart.cpp index 49aa1c195..81d06f4ed 100644 --- a/src/coremods/core_oper/cmd_restart.cpp +++ b/src/coremods/core_oper/cmd_restart.cpp @@ -30,7 +30,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.Log(MODNAME, LOG_DEFAULT, "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 4be9e82b4..76fcb0815 100644 --- a/src/coremods/core_reloadmodule.cpp +++ b/src/coremods/core_reloadmodule.cpp @@ -471,14 +471,14 @@ void DataKeeper::RestoreMemberData(Channel* chan, const std::vector<ChanData::Me User* const user = ServerInstance->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.Log(MODNAME, LOG_DEBUG, "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.Log(MODNAME, LOG_DEBUG, "Member %s is no longer on channel %s", md.owner.c_str(), chan->name.c_str()); continue; } @@ -517,16 +517,16 @@ void DataKeeper::Save(Module* currmod) FOREACH_MOD_CUSTOM(*reloadevprov, ReloadModule::EventListener, OnReloadModuleSave, (mod, this->moddata)); - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Saved data about %lu users %lu chans %lu modules", (unsigned long)userdatalist.size(), (unsigned long)chandatalist.size(), (unsigned long)moddata.list.size()); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Saved data about %lu users %lu chans %lu modules", (unsigned long)userdatalist.size(), (unsigned long)chandatalist.size(), (unsigned long)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.Log(MODNAME, LOG_DEBUG, "%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.Log(MODNAME, LOG_DEBUG, "%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) @@ -575,14 +575,14 @@ void DataKeeper::Restore(Module* newmod) DoRestoreChans(); DoRestoreModules(); - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Restore finished"); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Restore finished"); } void DataKeeper::Fail() { this->mod = NULL; - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Restore failed, notifying modules"); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Restore failed, notifying modules"); DoRestoreModules(); } @@ -636,7 +636,7 @@ bool DataKeeper::RestoreSerializer(size_t serializerindex, User* user) void DataKeeper::DoRestoreUsers() { - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Restoring user data"); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Restoring user data"); Modes::ChangeList modechange; for (std::vector<UserData>::const_iterator i = userdatalist.begin(); i != userdatalist.end(); ++i) @@ -645,7 +645,7 @@ void DataKeeper::DoRestoreUsers() User* const user = ServerInstance->FindUUID(userdata.owner); if (!user) { - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "User %s is gone", userdata.owner.c_str()); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "User %s is gone", userdata.owner.c_str()); continue; } @@ -661,7 +661,7 @@ void DataKeeper::DoRestoreUsers() void DataKeeper::DoRestoreChans() { - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Restoring channel data"); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Restoring channel data"); Modes::ChangeList modechange; for (std::vector<ChanData>::const_iterator i = chandatalist.begin(); i != chandatalist.end(); ++i) @@ -670,7 +670,7 @@ void DataKeeper::DoRestoreChans() Channel* const chan = ServerInstance->FindChan(chandata.owner); if (!chan) { - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Channel %s not found", chandata.owner.c_str()); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Channel %s not found", chandata.owner.c_str()); continue; } @@ -691,7 +691,7 @@ void DataKeeper::DoRestoreModules() for (ReloadModule::CustomData::List::iterator i = moddata.list.begin(); i != moddata.list.end(); ++i) { ReloadModule::CustomData::Data& data = *i; - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Calling module data handler %p", (void*)data.handler); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Calling module data handler %p", (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 c0eaa7601..837fa3802 100644 --- a/src/coremods/core_serialize_rfc.cpp +++ b/src/coremods/core_serialize_rfc.cpp @@ -62,7 +62,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.Log("USERINPUT", LOG_RAWIO, "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_whowas.cpp b/src/coremods/core_whowas.cpp index a17b362e1..6b20f1526 100644 --- a/src/coremods/core_whowas.cpp +++ b/src/coremods/core_whowas.cpp @@ -234,7 +234,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.Log(MODNAME, LOG_DEFAULT, "ERROR: Inconsistency detected in whowas database, please report"); return; } PurgeNick(it); diff --git a/src/cull_list.cpp b/src/cull_list.cpp index 73f2def51..342f0b77a 100644 --- a/src/cull_list.cpp +++ b/src/cull_list.cpp @@ -49,17 +49,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.Log("CULLLIST", LOG_DEBUG, "Deleting %s @%p", typeid(*c).name(), (void*)c); #else - ServerInstance->Logs->Log("CULLLIST", LOG_DEBUG, "Deleting @%p", (void*)c); + ServerInstance->Logs.Log("CULLLIST", LOG_DEBUG, "Deleting @%p", (void*)c); #endif c->cull(); queue.push_back(c); } else { - ServerInstance->Logs->Log("CULLLIST", LOG_DEBUG, "WARNING: Object @%p culled twice!", + ServerInstance->Logs.Log("CULLLIST", LOG_DEBUG, "WARNING: Object @%p culled twice!", (void*)c); } } @@ -71,7 +71,7 @@ void CullList::Apply() } if (list.size()) { - ServerInstance->Logs->Log("CULLLIST", LOG_DEBUG, "WARNING: Objects added to cull list in a destructor"); + ServerInstance->Logs.Log("CULLLIST", LOG_DEBUG, "WARNING: Objects added to cull list in a destructor"); Apply(); } } diff --git a/src/filelogger.cpp b/src/filelogger.cpp index 5786758da..5c6a4c937 100644 --- a/src/filelogger.cpp +++ b/src/filelogger.cpp @@ -24,13 +24,13 @@ FileLogStream::FileLogStream(LogLevel loglevel, FileWriter *fw) : LogStream(loglevel), f(fw) { - ServerInstance->Logs->AddLoggerRef(f); + ServerInstance->Logs.AddLoggerRef(f); } FileLogStream::~FileLogStream() { /* FileWriter is managed externally now */ - ServerInstance->Logs->DelLoggerRef(f); + ServerInstance->Logs.DelLoggerRef(f); } void FileLogStream::OnLog(LogLevel loglevel, const std::string &type, const std::string &text) diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp index 94a5240c9..ea586f226 100644 --- a/src/helperfuncs.cpp +++ b/src/helperfuncs.cpp @@ -343,7 +343,7 @@ void InspIRCd::CheckRoot() if (geteuid() == 0) { std::cout << "ERROR: You are running an irc server as root! DO NOT DO THIS!" << std::endl << std::endl; - this->Logs->Log("STARTUP", LOG_DEFAULT, "Can't start as root"); + this->Logs.Log("STARTUP", LOG_DEFAULT, "Can't start as root"); Exit(EXIT_STATUS_ROOT); } #endif diff --git a/src/inspircd.cpp b/src/inspircd.cpp index edcdc4339..d94b4e3b7 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -116,7 +116,7 @@ void InspIRCd::Cleanup() DeleteZero(this->XLines); DeleteZero(this->Config); SocketEngine::Deinit(); - Logs->CloseLogs(); + Logs.CloseLogs(); } void InspIRCd::SetSignals() @@ -171,13 +171,13 @@ bool InspIRCd::DaemonSeed() rlimit rl; if (getrlimit(RLIMIT_CORE, &rl) == -1) { - this->Logs->Log("STARTUP", LOG_DEFAULT, "Failed to getrlimit()!"); + this->Logs.Log("STARTUP", LOG_DEFAULT, "Failed to getrlimit()!"); return false; } rl.rlim_cur = rl.rlim_max; if (setrlimit(RLIMIT_CORE, &rl) == -1) - this->Logs->Log("STARTUP", LOG_DEFAULT, "setrlimit() failed, cannot increase coredump size."); + this->Logs.Log("STARTUP", LOG_DEFAULT, "setrlimit() failed, cannot increase coredump size."); return true; #endif @@ -188,7 +188,7 @@ void InspIRCd::WritePID(const std::string& filename, bool exitonfail) #ifndef _WIN32 if (!ServerInstance->Config->cmdline.writepid) { - this->Logs->Log("STARTUP", LOG_DEFAULT, "--nopid specified on command line; PID file not written."); + this->Logs.Log("STARTUP", LOG_DEFAULT, "--nopid specified on command line; PID file not written."); return; } @@ -205,7 +205,7 @@ void InspIRCd::WritePID(const std::string& filename, bool exitonfail) { if (exitonfail) std::cout << "Failed to write PID-file '" << fname << "', exiting." << std::endl; - this->Logs->Log("STARTUP", LOG_DEFAULT, "Failed to write PID-file '%s'%s", fname.c_str(), (exitonfail ? ", exiting." : "")); + this->Logs.Log("STARTUP", LOG_DEFAULT, "Failed to write PID-file '%s'%s", fname.c_str(), (exitonfail ? ", exiting." : "")); if (exitonfail) Exit(EXIT_STATUS_PID); } @@ -357,7 +357,7 @@ InspIRCd::InspIRCd(int argc, char** argv) : { FileWriter* fw = new FileWriter(stdout, 1); FileLogStream* fls = new FileLogStream(LOG_RAWIO, fw); - Logs->AddLogTypes("*", fls, true); + Logs.AddLogTypes("*", fls, true); } if (!FileSystem::FileExists(ConfigFileName)) @@ -375,7 +375,7 @@ InspIRCd::InspIRCd(int argc, char** argv) : #endif { std::cout << "ERROR: Cannot open config file: " << ConfigFileName << std::endl << "Exiting..." << std::endl; - this->Logs->Log("STARTUP", LOG_DEFAULT, "Unable to open config file %s", ConfigFileName.c_str()); + this->Logs.Log("STARTUP", LOG_DEFAULT, "Unable to open config file %s", ConfigFileName.c_str()); Exit(EXIT_STATUS_CONFIG); } } @@ -407,7 +407,7 @@ InspIRCd::InspIRCd(int argc, char** argv) : if (!this->DaemonSeed()) { std::cout << "ERROR: could not go into daemon mode. Shutting down." << std::endl; - Logs->Log("STARTUP", LOG_DEFAULT, "ERROR: could not go into daemon mode. Shutting down."); + Logs.Log("STARTUP", LOG_DEFAULT, "ERROR: could not go into daemon mode. Shutting down."); Exit(EXIT_STATUS_FORK); } } @@ -419,7 +419,7 @@ InspIRCd::InspIRCd(int argc, char** argv) : */ this->Config->Read(); this->Config->Apply(NULL, ""); - Logs->OpenFileLogs(); + Logs.OpenFileLogs(); // If we don't have a SID, generate one based on the server name and the server description if (Config->sid.empty()) @@ -465,7 +465,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.Log("STARTUP", LOG_DEFAULT, "Error killing parent process: %s",strerror(errno)); } } @@ -488,16 +488,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.Log("STARTUP", LOG_DEFAULT, "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.Log("STARTUP", LOG_DEFAULT, "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.Log("STARTUP", LOG_DEFAULT, "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.Log("STARTUP", LOG_DEFAULT, "Keeping pseudo-tty open as we are running in the foreground."); } #else /* Set win32 service as running, if we are running as a service */ @@ -512,7 +512,7 @@ InspIRCd::InspIRCd(int argc, char** argv) : QueryPerformanceFrequency(&stats.QPFrequency); #endif - 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.Log("STARTUP", LOG_DEFAULT, "Startup complete as '%s'[%s], %lu max open sockets", Config->ServerName.c_str(),Config->GetSID().c_str(), SocketEngine::GetMaxFds()); #ifndef _WIN32 ConfigTag* security = Config->ConfValue("security"); @@ -523,20 +523,20 @@ InspIRCd::InspIRCd(int argc, char** argv) : errno = 0; if (setgroups(0, NULL) == -1) { - this->Logs->Log("STARTUP", LOG_DEFAULT, "setgroups() failed (wtf?): %s", strerror(errno)); + this->Logs.Log("STARTUP", LOG_DEFAULT, "setgroups() failed (wtf?): %s", strerror(errno)); exit(EXIT_STATUS_CONFIG); } struct group* g = getgrnam(SetGroup.c_str()); if (!g) { - this->Logs->Log("STARTUP", LOG_DEFAULT, "getgrnam(%s) failed (wrong group?): %s", SetGroup.c_str(), strerror(errno)); + this->Logs.Log("STARTUP", LOG_DEFAULT, "getgrnam(%s) failed (wrong group?): %s", SetGroup.c_str(), strerror(errno)); exit(EXIT_STATUS_CONFIG); } if (setgid(g->gr_gid) == -1) { - this->Logs->Log("STARTUP", LOG_DEFAULT, "setgid(%d) failed (wrong group?): %s", g->gr_gid, strerror(errno)); + this->Logs.Log("STARTUP", LOG_DEFAULT, "setgid(%d) failed (wrong group?): %s", g->gr_gid, strerror(errno)); exit(EXIT_STATUS_CONFIG); } } @@ -548,13 +548,13 @@ InspIRCd::InspIRCd(int argc, char** argv) : struct passwd* u = getpwnam(SetUser.c_str()); if (!u) { - this->Logs->Log("STARTUP", LOG_DEFAULT, "getpwnam(%s) failed (wrong user?): %s", SetUser.c_str(), strerror(errno)); + this->Logs.Log("STARTUP", LOG_DEFAULT, "getpwnam(%s) failed (wrong user?): %s", SetUser.c_str(), strerror(errno)); exit(EXIT_STATUS_CONFIG); } if (setuid(u->pw_uid) == -1) { - this->Logs->Log("STARTUP", LOG_DEFAULT, "setuid(%d) failed (wrong user?): %s", u->pw_uid, strerror(errno)); + this->Logs.Log("STARTUP", LOG_DEFAULT, "setuid(%d) failed (wrong user?): %s", u->pw_uid, strerror(errno)); exit(EXIT_STATUS_CONFIG); } } @@ -608,7 +608,7 @@ void InspIRCd::Run() if (this->ConfigThread && this->ConfigThread->IsDone()) { /* Rehash has completed */ - this->Logs->Log("CONFIG", LOG_DEBUG, "Detected ConfigThread exiting, tidying up..."); + this->Logs.Log("CONFIG", LOG_DEBUG, "Detected ConfigThread exiting, tidying up..."); this->ConfigThread->Finish(); diff --git a/src/inspsocket.cpp b/src/inspsocket.cpp index ebbff448e..892fe0c84 100644 --- a/src/inspsocket.cpp +++ b/src/inspsocket.cpp @@ -64,7 +64,7 @@ BufferedSocketError BufferedSocket::BeginConnect(const std::string& ipaddr, int irc::sockets::sockaddrs addr, bind; if (!irc::sockets::aptosa(ipaddr, aport, addr)) { - ServerInstance->Logs->Log("SOCKET", LOG_DEBUG, "BUG: Hostname passed to BufferedSocket, rather than an IP address!"); + ServerInstance->Logs.Log("SOCKET", LOG_DEBUG, "BUG: Hostname passed to BufferedSocket, rather than an IP address!"); return I_ERR_CONNECT; } @@ -110,7 +110,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.Log("SOCKET", LOG_DEBUG, "BufferedSocket::DoConnect success"); return I_ERR_NONE; } @@ -230,7 +230,7 @@ void StreamSocket::DoWrite() return; if (!error.empty() || fd < 0) { - ServerInstance->Logs->Log("SOCKET", LOG_DEBUG, "DoWrite on errored or closed socket"); + ServerInstance->Logs.Log("SOCKET", LOG_DEBUG, "DoWrite on errored or closed socket"); return; } @@ -367,7 +367,7 @@ void StreamSocket::WriteData(const std::string &data) { if (fd < 0) { - ServerInstance->Logs->Log("SOCKET", LOG_DEBUG, "Attempt to write data to dead socket: %s", + ServerInstance->Logs.Log("SOCKET", LOG_DEBUG, "Attempt to write data to dead socket: %s", data.c_str()); return; } @@ -380,7 +380,7 @@ void StreamSocket::WriteData(const std::string &data) bool SocketTimeout::Tick(time_t) { - ServerInstance->Logs->Log("SOCKET", LOG_DEBUG, "SocketTimeout::Tick"); + ServerInstance->Logs.Log("SOCKET", LOG_DEBUG, "SocketTimeout::Tick"); if (SocketEngine::GetRef(this->sfd) != this->sock) { @@ -472,7 +472,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.Log("SOCKET", LOG_DEFAULT, "Caught exception in socket processing on FD %d - '%s'", fd, ex.GetReason().c_str()); SetError(ex.GetReason()); } CheckError(I_ERR_OTHER); @@ -491,7 +491,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.Log("SOCKET", LOG_DEBUG, "Error on FD %d - '%s'", fd, error.c_str()); OnError(errcode); } } diff --git a/src/listensocket.cpp b/src/listensocket.cpp index 60ee0b449..db5976821 100644 --- a/src/listensocket.cpp +++ b/src/listensocket.cpp @@ -106,14 +106,14 @@ ListenSocket::~ListenSocket() { if (this->GetFd() > -1) { - ServerInstance->Logs->Log("SOCKET", LOG_DEBUG, "Shut down listener on fd %d", this->fd); + ServerInstance->Logs.Log("SOCKET", LOG_DEBUG, "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.Log("SOCKET", LOG_DEBUG, "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.Log("SOCKET", LOG_DEBUG, "Failed to unlink UNIX socket: %s", strerror(errno)); } } @@ -125,7 +125,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.Log("SOCKET", LOG_DEBUG, "Accepting connection on socket %s fd %d", bind_sa.str().c_str(), incomingSockfd); if (incomingSockfd < 0) { ServerInstance->stats.Refused++; @@ -135,7 +135,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.Log("SOCKET", LOG_DEBUG, "Can't get peername: %s", strerror(errno)); } if (client.family() == AF_INET6) @@ -196,7 +196,7 @@ void ListenSocket::OnEventHandlerRead() else { ServerInstance->stats.Refused++; - ServerInstance->Logs->Log("SOCKET", LOG_DEFAULT, "Refusing connection on %s - %s", + ServerInstance->Logs.Log("SOCKET", LOG_DEFAULT, "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/modulemanager.cpp b/src/modulemanager.cpp index 5ed7d12d5..1883cf028 100644 --- a/src/modulemanager.cpp +++ b/src/modulemanager.cpp @@ -40,14 +40,14 @@ bool ModuleManager::Load(const std::string& modname, bool defer) if (!FileSystem::FileExists(moduleFile)) { LastModuleError = "Module file could not be found: " + filename; - ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, LastModuleError); + ServerInstance->Logs.Log("MODULE", LOG_DEFAULT, 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.Log("MODULE", LOG_DEFAULT, LastModuleError); return false; } @@ -72,7 +72,7 @@ bool ModuleManager::Load(const std::string& modname, bool defer) version.assign("unknown"); if (defer) { - ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, "New module introduced: %s (Module version %s)", + ServerInstance->Logs.Log("MODULE", LOG_DEFAULT, "New module introduced: %s (Module version %s)", filename.c_str(), version.c_str()); } else @@ -85,14 +85,14 @@ bool ModuleManager::Load(const std::string& modname, bool defer) newmod->ReadConfig(confstatus); Version v = newmod->GetVersion(); - ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, "New module introduced: %s (Module version %s)%s", + ServerInstance->Logs.Log("MODULE", LOG_DEFAULT, "New module introduced: %s (Module version %s)%s", filename.c_str(), version.c_str(), (!(v.Flags & VF_VENDOR) ? " [3rd Party]" : " [Vendor]")); } } else { LastModuleError = "Unable to load " + filename + ": " + newhandle->LastError(); - ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, LastModuleError); + ServerInstance->Logs.Log("MODULE", LOG_DEFAULT, LastModuleError); delete newhandle; return false; } @@ -110,7 +110,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.Log("MODULE", LOG_DEFAULT, LastModuleError); return false; } @@ -142,7 +142,7 @@ void ModuleManager::LoadCoreModules(std::map<std::string, ServiceList>& servicem if (!Load(entry->d_name, true)) { - ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, this->LastError()); + ServerInstance->Logs.Log("MODULE", LOG_DEFAULT, this->LastError()); std::cout << std::endl << "[" << con_red << "*" << con_reset << "] " << this->LastError() << std::endl << std::endl; ServerInstance->Exit(EXIT_STATUS_MODULE); } diff --git a/src/modules.cpp b/src/modules.cpp index 65d22e232..d0a8408c3 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -324,7 +324,7 @@ bool ModuleManager::PrioritizeHooks() break; if (tries == 19) { - ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, "Hook priority dependency loop detected"); + ServerInstance->Logs.Log("MODULE", LOG_DEFAULT, "Hook priority dependency loop detected"); return false; } } @@ -338,7 +338,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.Log("MODULE", LOG_DEFAULT, LastModuleError); return false; } @@ -413,7 +413,7 @@ void ModuleManager::DoSafeUnload(Module* mod) Modules.erase(modfind); ServerInstance->GlobalCulls.AddItem(mod); - ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, "Module %s unloaded",mod->ModuleSourceFile.c_str()); + ServerInstance->Logs.Log("MODULE", LOG_DEFAULT, "Module %s unloaded",mod->ModuleSourceFile.c_str()); ServerInstance->ISupport.Build(); } @@ -485,7 +485,7 @@ void ModuleManager::LoadAll() std::cout << "[" << con_green << "*" << con_reset << "] Loading module:\t" << con_green << name << con_reset << std::endl; if (!this->Load(name, true)) { - ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, this->LastError()); + ServerInstance->Logs.Log("MODULE", LOG_DEFAULT, this->LastError()); std::cout << std::endl << "[" << con_red << "*" << con_reset << "] " << this->LastError() << std::endl << std::endl; ServerInstance->Exit(EXIT_STATUS_MODULE); } @@ -498,7 +498,7 @@ void ModuleManager::LoadAll() Module* mod = i->second; try { - ServerInstance->Logs->Log("MODULE", LOG_DEBUG, "Initializing %s", i->first.c_str()); + ServerInstance->Logs.Log("MODULE", LOG_DEBUG, "Initializing %s", i->first.c_str()); AttachAll(mod); AddServices(servicemap[i->first]); mod->init(); @@ -507,7 +507,7 @@ void ModuleManager::LoadAll() catch (CoreException& modexcept) { LastModuleError = "Unable to initialize " + mod->ModuleSourceFile + ": " + modexcept.GetReason(); - ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, LastModuleError); + ServerInstance->Logs.Log("MODULE", LOG_DEFAULT, LastModuleError); std::cout << std::endl << "[" << con_red << "*" << con_reset << "] " << LastModuleError << std::endl << std::endl; ServerInstance->Exit(EXIT_STATUS_MODULE); } diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp index c590750cf..4d2a206dc 100644 --- a/src/modules/extra/m_mysql.cpp +++ b/src/modules/extra/m_mysql.cpp @@ -273,7 +273,7 @@ class SQLConnection : public SQL::Provider // Enable character set settings std::string charset = config->getString("charset"); if ((!charset.empty()) && (mysql_set_character_set(connection, charset.c_str()))) - ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "WARNING: Could not set character set to \"%s\"", charset.c_str()); + ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "WARNING: Could not set character set to \"%s\"", charset.c_str()); std::string initquery; if (config->readString("initialquery", initquery)) diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp index 32bbd4459..db9c8ac09 100644 --- a/src/modules/extra/m_pgsql.cpp +++ b/src/modules/extra/m_pgsql.cpp @@ -179,7 +179,7 @@ class SQLConn : public SQL::Provider, public EventHandler { if (!DoConnect()) { - ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "WARNING: Could not connect to database " + tag->getString("id")); + ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "WARNING: Could not connect to database " + tag->getString("id")); DelayReconnect(); } } @@ -272,7 +272,7 @@ class SQLConn : public SQL::Provider, public EventHandler if (!SocketEngine::AddFd(this, FD_WANT_NO_WRITE | FD_WANT_NO_READ)) { - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "BUG: Couldn't add pgsql socket to socket engine"); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "BUG: Couldn't add pgsql socket to socket engine"); return false; } @@ -444,7 +444,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.Log(MODNAME, LOG_DEBUG, "BUG: Apparently PQescapeStringConn() failed"); res.append(&buffer[0], escapedsize); } } @@ -475,7 +475,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.Log(MODNAME, LOG_DEBUG, "BUG: Apparently PQescapeStringConn() failed"); res.append(&buffer[0], escapedsize); } } diff --git a/src/modules/extra/m_regex_pcre.cpp b/src/modules/extra/m_regex_pcre.cpp index 7896d3e05..668eb646a 100644 --- a/src/modules/extra/m_regex_pcre.cpp +++ b/src/modules/extra/m_regex_pcre.cpp @@ -46,7 +46,7 @@ class PCRERegex : public Regex regex = pcre_compile(rx.c_str(), 0, &error, &erroffset, NULL); if (!regex) { - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "pcre_compile failed: /%s/ [%d] %s", rx.c_str(), erroffset, error); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "pcre_compile failed: /%s/ [%d] %s", rx.c_str(), erroffset, error); throw RegexException(rx, error, erroffset); } } diff --git a/src/modules/extra/m_sqlite3.cpp b/src/modules/extra/m_sqlite3.cpp index 14b3c20fc..f1a3ddb21 100644 --- a/src/modules/extra/m_sqlite3.cpp +++ b/src/modules/extra/m_sqlite3.cpp @@ -104,7 +104,7 @@ class SQLConn : public SQL::Provider // 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.Log(MODNAME, LOG_DEFAULT, "WARNING: Could not open DB with id: " + tag->getString("id")); } } diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index 2017d2e8f..2f7569d70 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -367,7 +367,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.Log(MODNAME, LOG_DEBUG, "Priority string token not recognized: \"%s\"", token.c_str()); ret.erase(prevpos); } else @@ -602,12 +602,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.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()); } 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.Log(MODNAME, LOG_DEFAULT, "Priority string for profile \"%s\" contains unknown tokens, stripped to \"%s\"", profilename.c_str(), stripped.c_str()); } priostr.swap(stripped); } @@ -1271,7 +1271,7 @@ class ModuleSSLGnuTLS : public Module // No <sslprofile> tags found, create a profile named "gnutls" from settings in the <gnutls> block const std::string defname = "gnutls"; ConfigTag* tag = ServerInstance->Config->ConfValue(defname); - ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "No <sslprofile> tags found; using settings from the <gnutls> tag"); + ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "No <sslprofile> tags found; using settings from the <gnutls> tag"); try { @@ -1293,7 +1293,7 @@ class ModuleSSLGnuTLS : public Module std::string name = tag->getString("name"); if (name.empty()) { - ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Ignoring <sslprofile> tag without name at " + tag->getTagLocation()); + ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Ignoring <sslprofile> tag without name at " + tag->getTagLocation()); continue; } @@ -1333,7 +1333,7 @@ class ModuleSSLGnuTLS : public Module 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.Log(MODNAME, LOG_DEFAULT, "GnuTLS lib version %s module was compiled for " GNUTLS_VERSION, gnutls_check_version(NULL)); ReadProfiles(); ServerInstance->GenRandom = RandGen::Call; } @@ -1349,7 +1349,7 @@ class ModuleSSLGnuTLS : public Module } catch (ModuleException& ex) { - ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, ex.GetReason() + " Not applying settings."); + ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, ex.GetReason() + " Not applying settings."); } } diff --git a/src/modules/extra/m_ssl_mbedtls.cpp b/src/modules/extra/m_ssl_mbedtls.cpp index 2786cd129..fbefbab07 100644 --- a/src/modules/extra/m_ssl_mbedtls.cpp +++ b/src/modules/extra/m_ssl_mbedtls.cpp @@ -249,7 +249,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.Log(MODNAME, LOG_DEBUG, "%s:%d %.*s", file, line, len, msg); } #endif @@ -860,7 +860,7 @@ class ModuleSSLmbedTLS : public Module // No <sslprofile> tags found, create a profile named "mbedtls" from settings in the <mbedtls> block const std::string defname = "mbedtls"; ConfigTag* tag = ServerInstance->Config->ConfValue(defname); - ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "No <sslprofile> tags found; using settings from the <mbedtls> tag"); + ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "No <sslprofile> tags found; using settings from the <mbedtls> tag"); try { @@ -882,7 +882,7 @@ class ModuleSSLmbedTLS : public Module std::string name = tag->getString("name"); if (name.empty()) { - ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Ignoring <sslprofile> tag without name at " + tag->getTagLocation()); + ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Ignoring <sslprofile> tag without name at " + tag->getTagLocation()); continue; } @@ -916,7 +916,7 @@ class ModuleSSLmbedTLS : public Module { 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.Log(MODNAME, LOG_DEFAULT, "mbedTLS lib version %s module was compiled for " MBEDTLS_VERSION_STRING, verbuf); if (!ctr_drbg.Seed(entropy)) throw ModuleException("CTR DRBG seed failed"); @@ -934,7 +934,7 @@ class ModuleSSLmbedTLS : public Module } catch (ModuleException& ex) { - ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, ex.GetReason() + " Not applying settings."); + ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, ex.GetReason() + " Not applying settings."); } } diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index f34a90094..5018cff86 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -335,9 +335,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.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); 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.Log(MODNAME, LOG_DEFAULT, "%s %s context options: %ld", name.c_str(), ctxname.c_str(), final); } public: @@ -398,7 +398,7 @@ namespace OpenSSL if ((!ctx.SetCA(filename)) || (!clictx.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.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()); } // Load the CRLs. @@ -638,7 +638,7 @@ class OpenSSLIOHook : public SSLIOHook if (status != ISSL_NONE) return true; - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Session %p killed, attempted to renegotiate", (void*)sess); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Session %p killed, attempted to renegotiate", (void*)sess); CloseSession(); sock->SetError("Renegotiation is not allowed"); return false; @@ -936,7 +936,7 @@ class ModuleSSLOpenSSL : public Module // Create a default profile named "openssl" const std::string defname = "openssl"; ConfigTag* tag = ServerInstance->Config->ConfValue(defname); - ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "No <sslprofile> tags found, using settings from the <openssl> tag"); + ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "No <sslprofile> tags found, using settings from the <openssl> tag"); try { @@ -957,7 +957,7 @@ class ModuleSSLOpenSSL : public Module std::string name = tag->getString("name"); if (name.empty()) { - ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Ignoring <sslprofile> tag without name at " + tag->getTagLocation()); + ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Ignoring <sslprofile> tag without name at " + tag->getTagLocation()); continue; } @@ -1000,7 +1000,7 @@ class ModuleSSLOpenSSL : public Module 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.Log(MODNAME, LOG_DEFAULT, "OpenSSL lib version \"%s\" module was compiled for \"" OPENSSL_VERSION_TEXT "\"", OpenSSL_version(OPENSSL_VERSION)); // Register application specific data char exdatastr[] = "inspircd"; @@ -1022,7 +1022,7 @@ class ModuleSSLOpenSSL : public Module } catch (ModuleException& ex) { - ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, ex.GetReason() + " Not applying settings."); + ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, ex.GetReason() + " Not applying settings."); } } diff --git a/src/modules/extra/m_sslrehashsignal.cpp b/src/modules/extra/m_sslrehashsignal.cpp index fea32326a..bbb0c4dc9 100644 --- a/src/modules/extra/m_sslrehashsignal.cpp +++ b/src/modules/extra/m_sslrehashsignal.cpp @@ -48,7 +48,7 @@ class ModuleSSLRehashSignal : public Module const std::string feedbackmsg = "Got SIGUSR1, reloading SSL credentials"; ServerInstance->SNO->WriteGlobalSno('a', feedbackmsg); - ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, feedbackmsg); + ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, feedbackmsg); const std::string str = "ssl"; FOREACH_MOD(OnModuleRehash, (NULL, str)); diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp index c0cb92663..0a1b64c48 100644 --- a/src/modules/m_callerid.cpp +++ b/src/modules/m_callerid.cpp @@ -137,12 +137,12 @@ struct CallerIDExtInfo : public ExtensionItem if (!targ) { - ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "ERROR: Inconsistency detected in callerid state, please report (1)"); + ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "ERROR: Inconsistency detected in callerid state, please report (1)"); continue; // shouldn't happen, but oh well. } if (!stdalgo::vector::swaperase(targ->wholistsme, dat)) - ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "ERROR: Inconsistency detected in callerid state, please report (2)"); + ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "ERROR: Inconsistency detected in callerid state, please report (2)"); } delete dat; } @@ -312,12 +312,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.Log(MODNAME, LOG_DEFAULT, "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.Log(MODNAME, LOG_DEFAULT, "ERROR: Inconsistency detected in callerid state, please report (4)"); user->WriteNotice(whotoremove->nick + " is no longer on your accept list"); @@ -372,7 +372,7 @@ class ModuleCallerID : public Module // 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.Log(MODNAME, LOG_DEFAULT, "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 838f6abe0..ebbd456d5 100644 --- a/src/modules/m_cap.cpp +++ b/src/modules/m_cap.cpp @@ -88,7 +88,7 @@ class Cap::ManagerImpl : public Cap::Manager, public ReloadModule::EventListener void OnReloadModuleSave(Module* mod, ReloadModule::CustomData& cd) override { - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "OnReloadModuleSave()"); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "OnReloadModuleSave()"); if (mod == creator) return; @@ -102,7 +102,7 @@ class Cap::ManagerImpl : public Cap::Manager, public ReloadModule::EventListener 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.Log(MODNAME, LOG_DEBUG, "Module being reloaded implements cap %s, saving cap users", cap->GetName().c_str()); capmoddata->caps.push_back(CapModData::Data(cap)); CapModData::Data& capdata = capmoddata->caps.back(); @@ -126,7 +126,7 @@ class Cap::ManagerImpl : public Cap::Manager, public ReloadModule::EventListener 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.Log(MODNAME, LOG_DEBUG, "Cap %s is no longer available after reload", capdata.name.c_str()); continue; } @@ -137,7 +137,7 @@ class Cap::ManagerImpl : public Cap::Manager, public ReloadModule::EventListener User* user = ServerInstance->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.Log(MODNAME, LOG_DEBUG, "User %s is gone when trying to restore cap %s", uuid.c_str(), capdata.name.c_str()); continue; } @@ -173,7 +173,7 @@ class Cap::ManagerImpl : public Cap::Manager, public ReloadModule::EventListener if (cap->IsRegistered()) return; - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Registering cap %s", cap->GetName().c_str()); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Registering cap %s", cap->GetName().c_str()); cap->bit = AllocateBit(); cap->extitem = &capext; caps.insert(std::make_pair(cap->GetName(), cap)); @@ -188,7 +188,7 @@ class Cap::ManagerImpl : public Cap::Manager, public ReloadModule::EventListener if (!cap->IsRegistered()) return; - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Unregistering cap %s", cap->GetName().c_str()); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "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 FOREACH_MOD_CUSTOM(evprov, Cap::EventListener, OnCapAddDel, (cap, false)); @@ -216,7 +216,7 @@ class Cap::ManagerImpl : public Cap::Manager, public ReloadModule::EventListener void NotifyValueChange(Capability* cap) override { - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Cap %s changed value", cap->GetName().c_str()); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Cap %s changed value", cap->GetName().c_str()); FOREACH_MOD_CUSTOM(evprov, Cap::EventListener, OnCapValueChange, (cap)); } diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp index ec926242e..c5ab0e71f 100644 --- a/src/modules/m_cgiirc.cpp +++ b/src/modules/m_cgiirc.cpp @@ -212,7 +212,7 @@ class CommandWebIRC : public SplitCommand if (notify) ServerInstance->SNO->WriteGlobalSno('w', buffer); else - ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, buffer); + ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, buffer); } }; @@ -400,7 +400,7 @@ class ModuleCgiIRC 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.Log(MODNAME, LOG_DEBUG, "BUG: OnWebIRCAuth(%s): socket type %d is unknown!", user->uuid.c_str(), user->client_sa.family()); return; } @@ -426,7 +426,7 @@ class ModuleCgiIRC 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.Log(MODNAME, LOG_DEBUG, "BUG: OnWebIRCAuth(%s): socket type %d is unknown!", user->uuid.c_str(), user->server_sa.family()); return; } diff --git a/src/modules/m_chanlog.cpp b/src/modules/m_chanlog.cpp index c7b288818..ba4a15fb6 100644 --- a/src/modules/m_chanlog.cpp +++ b/src/modules/m_chanlog.cpp @@ -49,7 +49,7 @@ class ModuleChanLog : public Module for (std::string::const_iterator it = snomasks.begin(); it != snomasks.end(); it++) { newlogs.insert(std::make_pair(*it, channel)); - ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Logging %c to %s", *it, channel.c_str()); + ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Logging %c to %s", *it, channel.c_str()); } } logstreams.swap(newlogs); diff --git a/src/modules/m_connectban.cpp b/src/modules/m_connectban.cpp index 6a880f827..e20f325f0 100644 --- a/src/modules/m_connectban.cpp +++ b/src/modules/m_connectban.cpp @@ -97,7 +97,7 @@ class ModuleConnectBan : public Module void OnGarbageCollect() override { - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Clearing map."); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Clearing map."); connects.clear(); } }; diff --git a/src/modules/m_customprefix.cpp b/src/modules/m_customprefix.cpp index d2f33de43..8a986c6e7 100644 --- a/src/modules/m_customprefix.cpp +++ b/src/modules/m_customprefix.cpp @@ -34,7 +34,7 @@ class CustomPrefixMode : public PrefixMode 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.Log(MODNAME, LOG_DEBUG, "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()); } }; @@ -70,7 +70,7 @@ class ModuleCustomPrefix : public Module 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.Log(MODNAME, LOG_DEBUG, "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_disable.cpp b/src/modules/m_disable.cpp index fb10a92a0..2310e7dfb 100644 --- a/src/modules/m_disable.cpp +++ b/src/modules/m_disable.cpp @@ -59,7 +59,7 @@ class ModuleDisable : public Module chr, field.c_str(), tag->getTagLocation().c_str())); // Disable the mode. - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "The %c (%s) %s mode has been disabled", + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "The %c (%s) %s mode has been disabled", mh->GetModeChar(), mh->name.c_str(), type == MODETYPE_CHANNEL ? "channel" : "user"); status.set(chr - 'A'); } @@ -73,7 +73,7 @@ class ModuleDisable : public Module if (notifyopers) ServerInstance->SNO->WriteToSnoMask('a', buffer); else - ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, buffer); + ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, buffer); } public: @@ -97,7 +97,7 @@ class ModuleDisable : public Module continue; // Disable the command. - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "The %s command has been disabled", handler->name.c_str()); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "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 9597922da..dd5499dcd 100644 --- a/src/modules/m_dnsbl.cpp +++ b/src/modules/m_dnsbl.cpp @@ -361,7 +361,7 @@ class ModuleDNSBL : public Module, public Stats::EventListener return; } else - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "User has no connect class in OnSetUserIP"); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "User has no connect class in OnSetUserIP"); std::string reversedip; if (user->client_sa.family() == AF_INET) @@ -388,7 +388,7 @@ class ModuleDNSBL : public Module, public Stats::EventListener else return; - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Reversed IP %s -> %s", user->GetIPString().c_str(), reversedip.c_str()); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Reversed IP %s -> %s", user->GetIPString().c_str(), reversedip.c_str()); countExt.set(user, DNSBLConfEntries.size()); @@ -407,7 +407,7 @@ class ModuleDNSBL : public Module, public Stats::EventListener catch (DNS::Exception &ex) { delete r; - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, ex.GetReason()); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, ex.GetReason()); } if (user->quitting) diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp index 1cb9184eb..04bbc1dbb 100644 --- a/src/modules/m_filter.cpp +++ b/src/modules/m_filter.cpp @@ -443,7 +443,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 " + target + ": " + f->reason + " Action: " + ModuleFilter::FilterActionToString(f->action)); + ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, user->nick + " had their message filtered, target was " + target + ": " + f->reason + " Action: " + ModuleFilter::FilterActionToString(f->action)); return MOD_RES_DENY; } return MOD_RES_PASSTHRU; @@ -675,7 +675,7 @@ void ModuleFilter::OnDecodeMetaData(Extensible* target, const std::string &extna } catch (ModuleException& e) { - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Error when unserializing filter: " + e.GetReason()); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Error when unserializing filter: " + e.GetReason()); } } } @@ -735,7 +735,7 @@ std::pair<bool, std::string> ModuleFilter::AddFilter(const std::string& freeform } catch (ModuleException &e) { - ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Error in regular expression '%s': %s", freeform.c_str(), e.GetReason().c_str()); + ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "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, ""); @@ -814,11 +814,11 @@ void ModuleFilter::ReadFilters() try { filters.push_back(FilterResult(RegexEngine, pattern, reason, fa, duration, flgs, true)); - ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Regular expression %s loaded.", pattern.c_str()); + ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Regular expression %s loaded.", pattern.c_str()); } catch (ModuleException &e) { - ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Error in regular expression '%s': %s", pattern.c_str(), e.GetReason().c_str()); + ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Error in regular expression '%s': %s", pattern.c_str(), e.GetReason().c_str()); } } } diff --git a/src/modules/m_hidemode.cpp b/src/modules/m_hidemode.cpp index fac636b70..8a0aa471f 100644 --- a/src/modules/m_hidemode.cpp +++ b/src/modules/m_hidemode.cpp @@ -51,7 +51,7 @@ class Settings if (!rank) throw ModuleException("<hidemode:rank> must be greater than 0 at " + tag->getTagLocation()); - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Hiding the %s mode from users below rank %u", modename.c_str(), rank); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Hiding the %s mode from users below rank %u", modename.c_str(), rank); newranks.insert(std::make_pair(modename, rank)); } rankstosee.swap(newranks); diff --git a/src/modules/m_httpd_acl.cpp b/src/modules/m_httpd_acl.cpp index 1e7a3f395..7b22bf8be 100644 --- a/src/modules/m_httpd_acl.cpp +++ b/src/modules/m_httpd_acl.cpp @@ -86,7 +86,7 @@ class ModuleHTTPAccessList : public Module, public HTTPACLEventListener } } - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Read ACL: path=%s pass=%s whitelist=%s blacklist=%s", path.c_str(), + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Read ACL: path=%s pass=%s whitelist=%s blacklist=%s", path.c_str(), password.c_str(), whitelist.c_str(), blacklist.c_str()); new_acls.push_back(HTTPACL(path, username, password, whitelist, blacklist)); @@ -96,7 +96,7 @@ class ModuleHTTPAccessList : public Module, public HTTPACLEventListener 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.Log(MODNAME, LOG_DEBUG, "BlockAccess (%u)", returnval); std::stringstream data("Access to this resource is denied by an access control list. Please contact your IRC administrator."); HTTPDocumentResponse response(this, *http, &data, returnval); @@ -109,7 +109,7 @@ class ModuleHTTPAccessList : public Module, public HTTPACLEventListener bool IsAccessAllowed(HTTPRequest* http) { { - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Handling httpd acl event"); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Handling httpd acl event"); for (std::vector<HTTPACL>::const_iterator this_acl = acl_list.begin(); this_acl != acl_list.end(); ++this_acl) { @@ -125,7 +125,7 @@ class ModuleHTTPAccessList : public Module, public HTTPACLEventListener { 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.Log(MODNAME, LOG_DEBUG, "Denying access to blacklisted resource %s (matched by pattern %s) from ip %s (matched by entry %s)", http->GetURI().c_str(), this_acl->path.c_str(), http->GetIP().c_str(), entry.c_str()); BlockAccess(http, 403); return false; @@ -147,7 +147,7 @@ class ModuleHTTPAccessList : public Module, public HTTPACLEventListener 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.Log(MODNAME, LOG_DEBUG, "Denying access to whitelisted resource %s (matched by pattern %s) from ip %s (Not in whitelist)", http->GetURI().c_str(), this_acl->path.c_str(), http->GetIP().c_str()); BlockAccess(http, 403); return false; @@ -156,7 +156,7 @@ class ModuleHTTPAccessList : public Module, public HTTPACLEventListener if (!this_acl->password.empty() && !this_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.Log(MODNAME, LOG_DEBUG, "Checking HTTP auth password for resource %s (matched by pattern %s) from ip %s, against username %s", http->GetURI().c_str(), this_acl->path.c_str(), http->GetIP().c_str(), this_acl->username.c_str()); if (http->headers->IsSet("Authorization")) @@ -175,7 +175,7 @@ class ModuleHTTPAccessList : public Module, public HTTPACLEventListener sep.GetToken(base64); std::string userpass = Base64ToBin(base64); - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "HTTP authorization: %s (%s)", userpass.c_str(), base64.c_str()); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "HTTP authorization: %s (%s)", userpass.c_str(), base64.c_str()); irc::sepstream userpasspair(userpass, ':'); if (userpasspair.GetToken(user)) @@ -185,7 +185,7 @@ class ModuleHTTPAccessList : public Module, public HTTPACLEventListener /* Access granted if username and password are correct */ if (user == this_acl->username && pass == this_acl->password) { - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "HTTP authorization: password and username match"); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "HTTP authorization: password and username match"); return true; } else diff --git a/src/modules/m_httpd_config.cpp b/src/modules/m_httpd_config.cpp index 12e42428a..88724b55d 100644 --- a/src/modules/m_httpd_config.cpp +++ b/src/modules/m_httpd_config.cpp @@ -37,7 +37,7 @@ class ModuleHttpConfig : public Module, public HTTPRequestEventListener if ((request.GetURI() != "/config") && (request.GetURI() != "/config/")) return MOD_RES_PASSTHRU; - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Handling request for the HTTP /config route"); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Handling request for the HTTP /config route"); std::stringstream buffer; ConfigDataHash& config = ServerInstance->Config->config_data; diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp index 7442587da..61a7aaac6 100644 --- a/src/modules/m_httpd_stats.cpp +++ b/src/modules/m_httpd_stats.cpp @@ -288,7 +288,7 @@ class ModuleHttpStats : public Module, public HTTPRequestEventListener if (uri[uri.size() - 1] == '/') uri.erase(uri.size() - 1, 1); - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Handling httpd event"); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Handling httpd event"); bool found = true; std::stringstream data; diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp index 96aa7ef26..0f3122cf0 100644 --- a/src/modules/m_ident.cpp +++ b/src/modules/m_ident.cpp @@ -187,7 +187,7 @@ class IdentRequestSocket : public EventHandler */ if (GetFd() > -1) { - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Close ident socket %d", GetFd()); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Close ident socket %d", GetFd()); SocketEngine::Close(this); } } @@ -217,7 +217,7 @@ class IdentRequestSocket : public EventHandler if (recvresult < 3) return; - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "ReadResponse()"); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "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 @@ class ModuleIdent : public Module } catch (ModuleException &e) { - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Ident exception: " + e.GetReason()); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Ident exception: " + e.GetReason()); } } diff --git a/src/modules/m_ircv3_sts.cpp b/src/modules/m_ircv3_sts.cpp index 226bdb3ac..650b4f4fb 100644 --- a/src/modules/m_ircv3_sts.cpp +++ b/src/modules/m_ircv3_sts.cpp @@ -94,21 +94,21 @@ class STSCap : public Cap::Capability 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.Log(MODNAME, LOG_DEBUG, "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.Log(MODNAME, LOG_DEBUG, "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.Log(MODNAME, LOG_DEBUG, "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 28d5efc1e..144ce3d20 100644 --- a/src/modules/m_ldapauth.cpp +++ b/src/modules/m_ldapauth.cpp @@ -157,7 +157,7 @@ class BindInterface : public LDAPInterface const std::string& attr = it->first; const std::string& val = it->second; - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "LDAP compare: %s=%s", attr.c_str(), val.c_str()); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "LDAP compare: %s=%s", attr.c_str(), val.c_str()); try { LDAP->Compare(this, DN, attr, val); diff --git a/src/modules/m_nationalchars.cpp b/src/modules/m_nationalchars.cpp index d5f92b99f..d1836d022 100644 --- a/src/modules/m_nationalchars.cpp +++ b/src/modules/m_nationalchars.cpp @@ -328,7 +328,7 @@ class ModuleNationalChars : public Module std::ifstream ifs(ServerInstance->Config->Paths.PrependConfig(filename).c_str()); if (ifs.fail()) { - ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "loadtables() called for missing file: %s", filename.c_str()); + ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "loadtables() called for missing file: %s", filename.c_str()); return false; } @@ -343,7 +343,7 @@ class ModuleNationalChars : public Module { if (loadtable(ifs, tables[n], 255) && (n < faillimit)) { - ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "loadtables() called for illegal file: %s (line %d)", filename.c_str(), n+1); + ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "loadtables() called for illegal file: %s (line %d)", filename.c_str(), n+1); return false; } } diff --git a/src/modules/m_operlog.cpp b/src/modules/m_operlog.cpp index 76c5f5d06..d6343ae50 100644 --- a/src/modules/m_operlog.cpp +++ b/src/modules/m_operlog.cpp @@ -53,7 +53,7 @@ class ModuleOperLog : public Module if ((thiscommand) && (thiscommand->flags_needed == 'o')) { std::string msg = "[" + user->GetFullRealHost() + "] " + command + " " + stdalgo::string::join(parameters); - ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "OPERLOG: " + msg); + ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "OPERLOG: " + msg); if (tosnomask) ServerInstance->SNO->WriteGlobalSno('r', msg); } diff --git a/src/modules/m_password_hash.cpp b/src/modules/m_password_hash.cpp index 726526d62..01eb6b256 100644 --- a/src/modules/m_password_hash.cpp +++ b/src/modules/m_password_hash.cpp @@ -93,7 +93,7 @@ class ModulePasswordHash : public Module 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.Log(MODNAME, LOG_DEFAULT, "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 f1eff77fe..463585070 100644 --- a/src/modules/m_permchannels.cpp +++ b/src/modules/m_permchannels.cpp @@ -66,7 +66,7 @@ static bool WriteDatabase(PermChannel& permchanmode, Module* mod, bool save_list std::ofstream stream(permchannelsnewconf.c_str()); if (!stream.is_open()) { - ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Cannot create database \"%s\"! %s (%d)", permchannelsnewconf.c_str(), strerror(errno), errno); + ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "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; } @@ -137,7 +137,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.Log(MODNAME, LOG_DEFAULT, "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; } @@ -149,7 +149,7 @@ static bool WriteDatabase(PermChannel& permchanmode, Module* mod, bool save_list // Use rename to move temporary to new db - this is guarenteed 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.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->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; } @@ -195,7 +195,7 @@ public: if ((channel.empty()) || (channel.length() > ServerInstance->Config->Limits.ChanMax)) { - ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Ignoring permchannels tag with empty or too long channel name (\"" + channel + "\")"); + ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Ignoring permchannels tag with empty or too long channel name (\"" + channel + "\")"); continue; } @@ -219,7 +219,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.Log(MODNAME, LOG_DEBUG, "Added %s with topic %s", channel.c_str(), c->topic.c_str()); if (modes.empty()) continue; @@ -298,7 +298,7 @@ public: } catch (CoreException& e) { - ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Error loading permchannels database: " + std::string(e.GetReason())); + ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Error loading permchannels database: " + std::string(e.GetReason())); } } } diff --git a/src/modules/m_sasl.cpp b/src/modules/m_sasl.cpp index a0a308719..e3937dfbc 100644 --- a/src/modules/m_sasl.cpp +++ b/src/modules/m_sasl.cpp @@ -48,7 +48,7 @@ class ServerTracker : public ServerEventListener 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.Log(MODNAME, LOG_VERBOSE, "SASL target server \"%s\" %s", sasl_target.c_str(), (linked ? "came online" : "went offline")); online = linked; } } @@ -244,13 +244,13 @@ class SaslAuthenticator 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.Log(MODNAME, LOG_DEFAULT, "Services sent an unknown SASL message \"%s\" \"%s\"", msg[2].c_str(), msg[3].c_str()); break; case SASL_DONE: break; default: - ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "WTF: SaslState is not a known state (%d)", this->state); + ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "WTF: SaslState is not a known state (%d)", this->state); break; } @@ -361,7 +361,7 @@ class CommandSASL : public Command User* target = ServerInstance->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.Log(MODNAME, LOG_DEBUG, "User not found in sasl ENCAP event: %s", parameters[1].c_str()); return CMD_FAILURE; } @@ -411,7 +411,7 @@ class ModuleSASL : public Module void init() override { if (!ServerInstance->Modules->Find("m_services_account.so") || !ServerInstance->Modules->Find("m_cap.so")) - 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.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!"); } void ReadConfig(ConfigStatus& status) override diff --git a/src/modules/m_showfile.cpp b/src/modules/m_showfile.cpp index 52f2ded11..67bbda390 100644 --- a/src/modules/m_showfile.cpp +++ b/src/modules/m_showfile.cpp @@ -153,7 +153,7 @@ class ModuleShowFile : public Module } catch (CoreException& ex) { - ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Error: " + ex.GetReason() + " at " + tag->getTagLocation()); + ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Error: " + ex.GetReason() + " at " + tag->getTagLocation()); } } diff --git a/src/modules/m_spanningtree/compat.cpp b/src/modules/m_spanningtree/compat.cpp index 17bc7cbc6..d95465f40 100644 --- a/src/modules/m_spanningtree/compat.cpp +++ b/src/modules/m_spanningtree/compat.cpp @@ -26,7 +26,7 @@ static std::string newline("\n"); void TreeSocket::WriteLineNoCompat(const std::string& line) { - ServerInstance->Logs->Log(MODNAME, LOG_RAWIO, "S[%d] O %s", this->GetFd(), line.c_str()); + ServerInstance->Logs.Log(MODNAME, LOG_RAWIO, "S[%d] O %s", this->GetFd(), line.c_str()); this->WriteData(line); this->WriteData(newline); } @@ -368,7 +368,7 @@ bool TreeSocket::PreProcessOldProtocolMessage(User*& who, std::string& cmd, Comm if (!server) { // We've no idea what this is, log and stop processing - ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Received a " + cmd + " with an unknown target: \"" + params[0] + "\", command dropped"); + ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Received a " + cmd + " with an unknown target: \"" + params[0] + "\", command dropped"); return false; } @@ -541,7 +541,7 @@ bool TreeSocket::PreProcessOldProtocolMessage(User*& who, std::string& cmd, Comm TreeServer* const numericsource = Utils->FindServer(srcstr); if (!numericsource) { - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Unable to translate PUSH numeric %s to user %s from 1202 protocol server %s: source \"%s\" doesn't exist", token.c_str(), params[0].c_str(), this->MyRoot->GetName().c_str(), srcstr.c_str()); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Unable to translate PUSH numeric %s to user %s from 1202 protocol server %s: source \"%s\" doesn't exist", token.c_str(), params[0].c_str(), this->MyRoot->GetName().c_str(), srcstr.c_str()); return false; } @@ -570,7 +570,7 @@ bool TreeSocket::PreProcessOldProtocolMessage(User*& who, std::string& cmd, Comm ts.GetMiddle(token); if (token.c_str()[0] == '#') { - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Unable to translate PUSH %s to user %s from 1202 protocol server %s, target \"%s\"", cmd.c_str(), params[0].c_str(), this->MyRoot->GetName().c_str(), token.c_str()); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Unable to translate PUSH %s to user %s from 1202 protocol server %s, target \"%s\"", cmd.c_str(), params[0].c_str(), this->MyRoot->GetName().c_str(), token.c_str()); return false; } @@ -579,7 +579,7 @@ bool TreeSocket::PreProcessOldProtocolMessage(User*& who, std::string& cmd, Comm } else { - ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Unable to translate PUSH to user %s from 1202 protocol server %s", params[0].c_str(), this->MyRoot->GetName().c_str()); + ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Unable to translate PUSH to user %s from 1202 protocol server %s", params[0].c_str(), this->MyRoot->GetName().c_str()); return false; } diff --git a/src/modules/m_spanningtree/fjoin.cpp b/src/modules/m_spanningtree/fjoin.cpp index a6c52e41b..ee4447fa9 100644 --- a/src/modules/m_spanningtree/fjoin.cpp +++ b/src/modules/m_spanningtree/fjoin.cpp @@ -133,7 +133,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.Log(MODNAME, LOG_DEBUG, "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) @@ -143,7 +143,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.Log(MODNAME, LOG_DEBUG, "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 2001d560d..0343f9611 100644 --- a/src/modules/m_spanningtree/hmac.cpp +++ b/src/modules/m_spanningtree/hmac.cpp @@ -59,7 +59,7 @@ std::string TreeSocket::MakePass(const std::string &password, const std::string return "AUTH:" + BinToBase64(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. m_sha256) loaded!"); + ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Not authenticating to server using SHA256/HMAC because we don't have an SHA256 provider (e.g. m_sha256) loaded!"); return password; } diff --git a/src/modules/m_spanningtree/ijoin.cpp b/src/modules/m_spanningtree/ijoin.cpp index d33ef3d4e..2d66b55e0 100644 --- a/src/modules/m_spanningtree/ijoin.cpp +++ b/src/modules/m_spanningtree/ijoin.cpp @@ -30,7 +30,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 non-existant channel: " + params[0]); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Received IJOIN for non-existant channel: " + params[0]); CmdBuilder("RESYNC").push(params[0]).Unicast(user); @@ -57,12 +57,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.Log(MODNAME, LOG_DEBUG, "Resyncing " + params[0]); Channel* chan = ServerInstance->FindChan(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.Log(MODNAME, LOG_DEBUG, "Channel does not exist"); return CMD_FAILURE; } diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index de1e8eb19..a66dad133 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -568,7 +568,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.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); } } @@ -589,7 +589,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.Log(MODNAME, LOG_DEBUG, "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 62e200921..071d15b3a 100644 --- a/src/modules/m_spanningtree/nickcollide.cpp +++ b/src/modules/m_spanningtree/nickcollide.cpp @@ -86,7 +86,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.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, 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 d3eab825f..200d2ee24 100644 --- a/src/modules/m_spanningtree/postcommand.cpp +++ b/src/modules/m_spanningtree/postcommand.cpp @@ -57,7 +57,7 @@ void SpanningTreeUtilities::RouteCommand(TreeServer* origin, CommandBase* thiscm sdest = FindRouteTarget(routing.serverdest); if (!sdest) { - ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Trying to route %s%s to nonexistent server %s", (encap ? "ENCAP " : ""), command.c_str(), routing.serverdest.c_str()); + ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Trying to route %s%s to nonexistent server %s", (encap ? "ENCAP " : ""), command.c_str(), routing.serverdest.c_str()); return; } } @@ -75,7 +75,7 @@ void SpanningTreeUtilities::RouteCommand(TreeServer* origin, CommandBase* thiscm if (!(ver.Flags & (VF_COMMON | VF_CORE)) && srcmodule != Creator) { - ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Routed command %s from non-VF_COMMON module %s", + ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "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 ded0573af..a5492e743 100644 --- a/src/modules/m_spanningtree/resolvers.cpp +++ b/src/modules/m_spanningtree/resolvers.cpp @@ -137,7 +137,7 @@ void SecurityIPResolver::OnError(const DNS::Query *r) delete res; } } - ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Could not resolve IP associated with Link '%s': %s", + ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "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 07004a1e8..d820de466 100644 --- a/src/modules/m_spanningtree/server.cpp +++ b/src/modules/m_spanningtree/server.cpp @@ -182,7 +182,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.Log(MODNAME, LOG_DEBUG, "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 a5dae783c..fbe0f22e2 100644 --- a/src/modules/m_spanningtree/sinfo.cpp +++ b/src/modules/m_spanningtree/sinfo.cpp @@ -41,7 +41,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.Log(MODNAME, LOG_DEFAULT, "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 65e0a2c4d..f52e569a2 100644 --- a/src/modules/m_spanningtree/treeserver.cpp +++ b/src/modules/m_spanningtree/treeserver.cpp @@ -58,7 +58,7 @@ TreeServer::TreeServer(const std::string& Name, const std::string& Desc, const s , ServerUser(new FakeUser(id, this)) , age(ServerInstance->Time()), UserCount(0), OperCount(0), rtt(0), StartBurst(0), Hidden(Hide) { - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "New server %s behind_bursting %u", GetName().c_str(), behind_bursting); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "New server %s behind_bursting %u", GetName().c_str(), behind_bursting); CheckULine(); ServerInstance->Timers.AddTimer(&pingtimer); @@ -129,7 +129,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", sid.c_str(), ConvToStr(startms).c_str(), behind_bursting); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Server %s started bursting at time %s behind_bursting %u", sid.c_str(), ConvToStr(startms).c_str(), behind_bursting); } void TreeServer::FinishBurstInternal() @@ -138,7 +138,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.Log(MODNAME, LOG_DEBUG, "FinishBurstInternal() %s behind_bursting %u", GetName().c_str(), behind_bursting); for (ChildServers::const_iterator i = Children.begin(); i != Children.end(); ++i) { @@ -193,7 +193,7 @@ void TreeServer::SQuitChild(TreeServer* server, const std::string& reason) void TreeServer::SQuitInternal(unsigned int& num_lost_servers) { - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Server %s lost in split", GetName().c_str()); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Server %s lost in split", GetName().c_str()); for (ChildServers::const_iterator i = Children.begin(); i != Children.end(); ++i) { @@ -241,7 +241,7 @@ void TreeServer::CheckULine() { if (this->IsRoot()) { - ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Servers should not uline themselves (at " + tag->getTagLocation() + ")"); + ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Servers should not uline themselves (at " + tag->getTagLocation() + ")"); return; } diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp index 062d04222..118be622b 100644 --- a/src/modules/m_spanningtree/treesocket1.cpp +++ b/src/modules/m_spanningtree/treesocket1.cpp @@ -150,7 +150,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.Log(MODNAME, LOG_DEFAULT, "Squit from unknown server"); return CMD_FAILURE; } @@ -196,8 +196,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.Log(MODNAME, LOG_DEFAULT, "Error while processing: " + line); + ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, ex.GetReason()); SendError(ex.GetReason() + " - check the log file for details"); } diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index 45f8a380f..103327a72 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -90,7 +90,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.Log(MODNAME, LOG_RAWIO, "S[%d] I %s", this->GetFd(), line.c_str()); Split(line, tags, prefix, command, params); @@ -305,7 +305,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.Log(MODNAME, LOG_DEBUG, "Command '%s' from unknown prefix '%s'! Dropping entire command.", command.c_str(), prefix.c_str()); return; } @@ -328,7 +328,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.Log(MODNAME, LOG_DEBUG, "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 1f2ed9c90..60af2fdb8 100644 --- a/src/modules/m_spanningtree/utils.cpp +++ b/src/modules/m_spanningtree/utils.cpp @@ -209,7 +209,7 @@ void SpanningTreeUtilities::RefreshIPCache() Link* L = *i; if (!L->Port) { - ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Ignoring a link block without a port."); + ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Ignoring a link block without a port."); /* Invalid link block */ continue; } @@ -300,11 +300,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.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."); } if (!L->Port) - 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.Log(MODNAME, LOG_DEFAULT, "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 7d1490e4d..b84eb6d5e 100644 --- a/src/modules/m_sqloper.cpp +++ b/src/modules/m_sqloper.cpp @@ -84,7 +84,7 @@ class OperQuery : public SQL::Query 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.Log(MODNAME, LOG_DEFAULT, "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; } @@ -108,7 +108,7 @@ class OperQuery : public SQL::Query void OnError(SQL::Error& error) override { - ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "query failed (%s)", error.ToString()); + ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "query failed (%s)", error.ToString()); ServerInstance->SNO->WriteGlobalSno('a', "m_sqloper: failed to update blocks from database"); if (!uid.empty()) { @@ -148,7 +148,7 @@ class OperQuery : public SQL::Query } else { - ServerInstance->Logs->Log(MODNAME, LOG_SPARSE, "BUG: WHAT?! Why do we have no OPER command?!"); + ServerInstance->Logs.Log(MODNAME, LOG_SPARSE, "BUG: WHAT?! Why do we have no OPER command?!"); } } }; @@ -209,7 +209,7 @@ public: */ return MOD_RES_DENY; } - ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "database not present"); + ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "database not present"); } else if (active) { diff --git a/src/modules/m_sslinfo.cpp b/src/modules/m_sslinfo.cpp index 7e08c8a3d..b6a208d39 100644 --- a/src/modules/m_sslinfo.cpp +++ b/src/modules/m_sslinfo.cpp @@ -128,7 +128,7 @@ class UserCertificateAPIImpl : public UserCertificateAPIBase void SetCertificate(User* user, ssl_cert* cert) override { - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Setting SSL certificate for %s: %s", + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Setting SSL certificate for %s: %s", user->GetFullHost().c_str(), cert->GetMetaLine().c_str()); sslext.set(user, cert); } @@ -292,12 +292,12 @@ class ModuleSSLInfo if (myclass->config->getString("requiressl") == "trusted") { ok = (cert && cert->IsCAVerified()); - ServerInstance->Logs->Log("CONNECTCLASS", LOG_DEBUG, "Class requires a trusted SSL cert. Client %s one.", (ok ? "has" : "does not have")); + ServerInstance->Logs.Log("CONNECTCLASS", LOG_DEBUG, "Class requires a trusted SSL cert. Client %s one.", (ok ? "has" : "does not have")); } else if (myclass->config->getBool("requiressl")) { ok = (cert != NULL); - ServerInstance->Logs->Log("CONNECTCLASS", LOG_DEBUG, "Class requires any SSL cert. Client %s one.", (ok ? "has" : "does not have")); + ServerInstance->Logs.Log("CONNECTCLASS", LOG_DEBUG, "Class requires any SSL cert. Client %s one.", (ok ? "has" : "does not have")); } if (!ok) diff --git a/src/modules/m_topiclock.cpp b/src/modules/m_topiclock.cpp index 1ddc6e65a..2ed881aa7 100644 --- a/src/modules/m_topiclock.cpp +++ b/src/modules/m_topiclock.cpp @@ -51,7 +51,7 @@ class CommandSVSTOPIC : public Command 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.Log(MODNAME, LOG_DEFAULT, "Received SVSTOPIC with a 0 topicts, dropped."); return CMD_INVALID; } diff --git a/src/modules/m_xline_db.cpp b/src/modules/m_xline_db.cpp index 9d9c9e431..48eb9badd 100644 --- a/src/modules/m_xline_db.cpp +++ b/src/modules/m_xline_db.cpp @@ -81,17 +81,17 @@ class ModuleXLineDB : public Module * 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.Log(MODNAME, LOG_DEBUG, "Opening temporary database"); std::string xlinenewdbpath = xlinedbpath + ".new"; std::ofstream stream(xlinenewdbpath.c_str()); if (!stream.is_open()) { - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Cannot create database \"%s\"! %s (%d)", xlinenewdbpath.c_str(), strerror(errno), errno); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "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.Log(MODNAME, LOG_DEBUG, "Opened. Writing.."); /* * Now, much as I hate writing semi-unportable formats, additional @@ -119,11 +119,11 @@ class ModuleXLineDB : public Module } } - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Finished writing XLines. Checking for error.."); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "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.Log(MODNAME, LOG_DEBUG, "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; } @@ -135,7 +135,7 @@ class ModuleXLineDB : public Module // Use rename to move temporary to new db - this is guarenteed 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.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->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; } @@ -152,7 +152,7 @@ class ModuleXLineDB : public Module std::ifstream stream(xlinedbpath.c_str()); if (!stream.is_open()) { - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Cannot read database \"%s\"! %s (%d)", xlinedbpath.c_str(), strerror(errno), errno); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "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; } @@ -172,14 +172,14 @@ class ModuleXLineDB : public Module items++; } - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Processing %s", line.c_str()); + ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "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.Log(MODNAME, LOG_DEBUG, "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/snomasks.cpp b/src/snomasks.cpp index e39fb84fb..3aa3407e2 100644 --- a/src/snomasks.cpp +++ b/src/snomasks.cpp @@ -123,7 +123,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.Log(desc, LOG_DEFAULT, 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 b33664f84..ebfc46e36 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -30,7 +30,7 @@ bool InspIRCd::BindPort(ConfigTag* tag, const irc::sockets::sockaddrs& sa, std:: 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.Log("SOCKET", LOG_DEFAULT, "Replacing listener on %s from old tag at %s with new tag from %s", sa.str().c_str(), (*n)->bind_tag->getTagLocation().c_str(), tag->getTagLocation().c_str()); (*n)->bind_tag = tag; (*n)->ResetIOHookProvider(); @@ -43,13 +43,13 @@ bool InspIRCd::BindPort(ConfigTag* tag, const irc::sockets::sockaddrs& sa, std:: ListenSocket* ll = new ListenSocket(tag, sa); if (ll->GetFd() < 0) { - ServerInstance->Logs->Log("SOCKET", LOG_DEFAULT, "Failed to listen on %s from tag at %s: %s", + ServerInstance->Logs.Log("SOCKET", LOG_DEFAULT, "Failed to listen on %s from tag at %s: %s", sa.str().c_str(), tag->getTagLocation().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->getTagLocation().c_str()); + ServerInstance->Logs.Log("SOCKET", LOG_DEFAULT, "Added a listener on %s from tag at %s", sa.str().c_str(), tag->getTagLocation().c_str()); ports.push_back(ll); return true; } @@ -71,11 +71,11 @@ int 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.Log("SOCKET", LOG_DEFAULT, "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.Log("SOCKET", LOG_DEFAULT, "TCP listener on %s at %s has no ports specified!", address.empty() ? "*" : address.c_str(), tag->getTagLocation().c_str()); irc::portparser portrange(portlist, false); @@ -102,7 +102,7 @@ int InspIRCd::BindPorts(FailedPortList& failed_ports) irc::sockets::sockaddrs bindspec; if (path.length() > std::min(ServerInstance->Config->Limits.MaxHost, sizeof(bindspec.un.sun_path))) { - this->Logs->Log("SOCKET", LOG_DEFAULT, "UNIX listener on %s at %s specified a path that is too long!", + this->Logs.Log("SOCKET", LOG_DEFAULT, "UNIX listener on %s at %s specified a path that is too long!", path.c_str(), tag->getTagLocation().c_str()); continue; } @@ -127,11 +127,11 @@ int 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.Log("SOCKET", LOG_DEFAULT, "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.Log("SOCKET", LOG_DEFAULT, "Port binding %s was removed from the config file, closing.", (**n).bind_sa.str().c_str()); delete *n; @@ -194,7 +194,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.Log("SOCKET", LOG_DEBUG, "BUG: irc::sockets::sockaddrs::port(): socket type %d is unknown!", family()); return 0; } @@ -219,7 +219,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.Log("SOCKET", LOG_DEBUG, "BUG: irc::sockets::sockaddrs::addr(): socket type %d is unknown!", family()); return "<unknown>"; } @@ -244,7 +244,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.Log("SOCKET", LOG_DEBUG, "BUG: irc::sockets::sockaddrs::str(): socket type %d is unknown!", family()); return "<unknown>"; } @@ -263,7 +263,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.Log("SOCKET", LOG_DEBUG, "BUG: irc::sockets::sockaddrs::sa_size(): socket type %d is unknown!", family()); return 0; } @@ -285,7 +285,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.Log("SOCKET", LOG_DEBUG, "BUG: irc::sockets::sockaddrs::operator==(): socket type %d is unknown!", family()); return !memcmp(this, &other, sizeof(*this)); } @@ -319,7 +319,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.Log("SOCKET", LOG_DEBUG, "BUG: sa2cidr(): socket type %d is unknown!", cidr.type); cidr.length = 0; return; } @@ -384,7 +384,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.Log("SOCKET", LOG_DEBUG, "BUG: irc::sockets::cidr_mask::str(): socket type %d is unknown!", type); return "<unknown>"; } diff --git a/src/socketengines/socketengine_epoll.cpp b/src/socketengines/socketengine_epoll.cpp index 60b365ee1..064ee913b 100644 --- a/src/socketengines/socketengine_epoll.cpp +++ b/src/socketengines/socketengine_epoll.cpp @@ -82,13 +82,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.Log("SOCKET", LOG_DEBUG, "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.Log("SOCKET", LOG_DEBUG, "Attempt to add duplicate fd: %d", fd); return false; } @@ -99,11 +99,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.Log("SOCKET", LOG_DEBUG, "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.Log("SOCKET", LOG_DEBUG, "New file descriptor: %d", fd); eh->SetEventMask(event_mask); ResizeDouble(events); @@ -131,7 +131,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.Log("SOCKET", LOG_DEBUG, "DelFd out of range: (fd: %d)", fd); return; } @@ -143,12 +143,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.Log("SOCKET", LOG_DEBUG, "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.Log("SOCKET", LOG_DEBUG, "Remove file descriptor: %d", fd); } int SocketEngine::DispatchEvents() diff --git a/src/socketengines/socketengine_kqueue.cpp b/src/socketengines/socketengine_kqueue.cpp index b23cfbd9d..ac7d6ca53 100644 --- a/src/socketengines/socketengine_kqueue.cpp +++ b/src/socketengines/socketengine_kqueue.cpp @@ -89,7 +89,7 @@ bool SocketEngine::AddFd(EventHandler* eh, int event_mask) struct kevent* ke = GetChangeKE(); EV_SET(ke, fd, EVFILT_READ, EV_ADD, 0, 0, static_cast<void*>(eh)); - ServerInstance->Logs->Log("SOCKET", LOG_DEBUG, "New file descriptor: %d", fd); + ServerInstance->Logs.Log("SOCKET", LOG_DEBUG, "New file descriptor: %d", fd); eh->SetEventMask(event_mask); OnSetEvent(eh, 0, event_mask); @@ -104,7 +104,7 @@ void SocketEngine::DelFd(EventHandler* eh) if (fd < 0) { - ServerInstance->Logs->Log("SOCKET", LOG_DEFAULT, "DelFd() on invalid fd: %d", fd); + ServerInstance->Logs.Log("SOCKET", LOG_DEFAULT, "DelFd() on invalid fd: %d", fd); return; } @@ -119,7 +119,7 @@ void SocketEngine::DelFd(EventHandler* eh) SocketEngine::DelFdRef(eh); - ServerInstance->Logs->Log("SOCKET", LOG_DEBUG, "Remove file descriptor: %d", fd); + ServerInstance->Logs.Log("SOCKET", LOG_DEBUG, "Remove file descriptor: %d", fd); } void SocketEngine::OnSetEvent(EventHandler* eh, int old_mask, int new_mask) diff --git a/src/socketengines/socketengine_poll.cpp b/src/socketengines/socketengine_poll.cpp index 339045a8c..517d5a6e8 100644 --- a/src/socketengines/socketengine_poll.cpp +++ b/src/socketengines/socketengine_poll.cpp @@ -66,13 +66,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.Log("SOCKET", LOG_DEBUG, "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.Log("SOCKET", LOG_DEBUG, "Attempt to add duplicate fd: %d", fd); return false; } @@ -80,7 +80,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.Log("SOCKET", LOG_DEBUG, "Attempt to add duplicate fd: %d", fd); return false; } @@ -92,7 +92,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.Log("SOCKET", LOG_DEBUG, "New file descriptor: %d (%d; index %d)", fd, events[index].events, index); eh->SetEventMask(event_mask); return true; } @@ -102,7 +102,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.Log("SOCKET", LOG_DEBUG, "SetEvents() on unknown fd: %d", eh->GetFd()); return; } @@ -114,13 +114,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.Log("SOCKET", LOG_DEBUG, "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.Log("SOCKET", LOG_DEBUG, "DelFd() on unknown fd: %d", fd); return; } @@ -148,7 +148,7 @@ void SocketEngine::DelFd(EventHandler* eh) SocketEngine::DelFdRef(eh); - ServerInstance->Logs->Log("SOCKET", LOG_DEBUG, "Remove file descriptor: %d (index: %d) " + ServerInstance->Logs.Log("SOCKET", LOG_DEBUG, "Remove file descriptor: %d (index: %d) " "(Filled gap with: %d (index: %d))", fd, index, last_fd, last_index); } diff --git a/src/socketengines/socketengine_select.cpp b/src/socketengines/socketengine_select.cpp index 03f0aca62..9d8225a24 100644 --- a/src/socketengines/socketengine_select.cpp +++ b/src/socketengines/socketengine_select.cpp @@ -69,7 +69,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.Log("SOCKET", LOG_DEBUG, "New file descriptor: %d", fd); return true; } @@ -91,7 +91,7 @@ void SocketEngine::DelFd(EventHandler* eh) if (fd == MaxFD) --MaxFD; - ServerInstance->Logs->Log("SOCKET", LOG_DEBUG, "Remove file descriptor: %d", fd); + ServerInstance->Logs.Log("SOCKET", LOG_DEBUG, "Remove file descriptor: %d", fd); } void SocketEngine::OnSetEvent(EventHandler* eh, int old_mask, int new_mask) diff --git a/src/threadengines/threadengine_win32.cpp b/src/threadengines/threadengine_win32.cpp index 0f0d1f277..f2a4fdc85 100644 --- a/src/threadengines/threadengine_win32.cpp +++ b/src/threadengines/threadengine_win32.cpp @@ -81,7 +81,7 @@ static bool BindAndListen(int sockfd, int port, const char* addr) if (SocketEngine::Listen(sockfd, ServerInstance->Config->MaxConn) != 0) { - ServerInstance->Logs->Log("SOCKET", LOG_DEFAULT, "ERROR in listen(): %s", strerror(errno)); + ServerInstance->Logs.Log("SOCKET", LOG_DEFAULT, "ERROR in listen(): %s", strerror(errno)); return false; } diff --git a/src/usermanager.cpp b/src/usermanager.cpp index c3f4105ef..1b50e7b4e 100644 --- a/src/usermanager.cpp +++ b/src/usermanager.cpp @@ -70,7 +70,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.Log("USERS", LOG_DEBUG, "New user fd: %d", socket); this->unregistered_count++; this->clientlist[New->nick] = New; @@ -80,7 +80,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.Log("USERS", LOG_DEBUG, "Internal error on new connection"); this->QuitUser(New, "Internal error handling connection"); return; } @@ -128,7 +128,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.Log("BANCACHE", LOG_DEBUG, "BanCache: Positive hit for " + New->GetIPString()); if (!ServerInstance->Config->XLineMessage.empty()) New->WriteNumeric(ERR_YOUREBANNEDCREEP, ServerInstance->Config->XLineMessage); @@ -140,7 +140,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.Log("BANCACHE", LOG_DEBUG, "BanCache: Negative hit for " + New->GetIPString()); } } else @@ -169,19 +169,19 @@ void UserManager::QuitUser(User* user, const std::string& quitreason, const std: { if (user->quitting) { - ServerInstance->Logs->Log("USERS", LOG_DEFAULT, "ERROR: Tried to quit quitting user: " + user->nick); + ServerInstance->Logs.Log("USERS", LOG_DEFAULT, "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.Log("USERS", LOG_DEFAULT, "ERROR: Tried to quit server user: " + user->nick); return; } user->quitting = true; - ServerInstance->Logs->Log("USERS", LOG_DEBUG, "QuitUser: %s=%s '%s'", user->uuid.c_str(), user->nick.c_str(), quitreason.c_str()); + ServerInstance->Logs.Log("USERS", LOG_DEBUG, "QuitUser: %s=%s '%s'", user->uuid.c_str(), user->nick.c_str(), quitreason.c_str()); LocalUser* const localuser = IS_LOCAL(user); if (localuser) { @@ -216,7 +216,7 @@ void UserManager::QuitUser(User* user, const std::string& quitreason, 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.Log("USERS", LOG_DEFAULT, "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 a9bed86ea..258d33488 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -76,7 +76,7 @@ User::User(const std::string& uid, Server* srv, UserType type) { client_sa.sa.sa_family = AF_UNSPEC; - ServerInstance->Logs->Log("USERS", LOG_DEBUG, "New UUID for user: %s", uuid.c_str()); + ServerInstance->Logs.Log("USERS", LOG_DEBUG, "New UUID for user: %s", uuid.c_str()); // Do not insert FakeUsers into the uuidlist so FindUUID() won't return them which is the desired behavior if (type != USERTYPE_SERVER) @@ -572,7 +572,7 @@ void LocalUser::FullConnect() ServerInstance->SNO->WriteToSnoMask('c',"Client connecting on port %d (class %s): %s (%s) [%s]", this->GetServerPort(), this->MyClass->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.Log("BANCACHE", LOG_DEBUG, "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; @@ -592,7 +592,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.Log("USERS", LOG_DEFAULT, "ERROR: Attempted to change nick of a quitting user: " + this->nick); return false; } @@ -786,7 +786,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(), (int) nlpos, text.c_str()); + ServerInstance->Logs.Log("USEROUTPUT", LOG_RAWIO, "C[%s] O %.*s", uuid.c_str(), (int) nlpos, text.c_str()); } eh.AddWriteBuf(text); @@ -801,7 +801,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.Log("USERS", LOG_DEBUG, "BUG: LocalUser::Send() called on %s who does not have a serializer!", GetFullRealHost().c_str()); return; } @@ -1070,7 +1070,7 @@ void LocalUser::SetClass(const std::string &explicit_name) { ConnectClass *found = NULL; - ServerInstance->Logs->Log("CONNECTCLASS", LOG_DEBUG, "Setting connect class for UID %s", this->uuid.c_str()); + ServerInstance->Logs.Log("CONNECTCLASS", LOG_DEBUG, "Setting connect class for UID %s", this->uuid.c_str()); if (!explicit_name.empty()) { @@ -1080,7 +1080,7 @@ void LocalUser::SetClass(const std::string &explicit_name) if (explicit_name == c->name) { - ServerInstance->Logs->Log("CONNECTCLASS", LOG_DEBUG, "Explicitly set to %s", explicit_name.c_str()); + ServerInstance->Logs.Log("CONNECTCLASS", LOG_DEBUG, "Explicitly set to %s", explicit_name.c_str()); found = c; } } @@ -1090,7 +1090,7 @@ void LocalUser::SetClass(const std::string &explicit_name) for (ServerConfig::ClassVector::const_iterator i = ServerInstance->Config->Classes.begin(); i != ServerInstance->Config->Classes.end(); ++i) { ConnectClass* c = *i; - ServerInstance->Logs->Log("CONNECTCLASS", LOG_DEBUG, "Checking %s", c->GetName().c_str()); + ServerInstance->Logs.Log("CONNECTCLASS", LOG_DEBUG, "Checking %s", c->GetName().c_str()); ModResult MOD_RESULT; FIRST_MOD_RESULT(OnSetConnectClass, MOD_RESULT, (this,c)); @@ -1098,7 +1098,7 @@ void LocalUser::SetClass(const std::string &explicit_name) continue; if (MOD_RESULT == MOD_RES_ALLOW) { - ServerInstance->Logs->Log("CONNECTCLASS", LOG_DEBUG, "Class forced by module to %s", c->GetName().c_str()); + ServerInstance->Logs.Log("CONNECTCLASS", LOG_DEBUG, "Class forced by module to %s", c->GetName().c_str()); found = c; break; } @@ -1114,7 +1114,7 @@ void LocalUser::SetClass(const std::string &explicit_name) if (!InspIRCd::MatchCIDR(this->GetIPString(), c->GetHost(), NULL) && !InspIRCd::MatchCIDR(this->GetRealHost(), c->GetHost(), NULL)) { - ServerInstance->Logs->Log("CONNECTCLASS", LOG_DEBUG, "No host match (for %s)", c->GetHost().c_str()); + ServerInstance->Logs.Log("CONNECTCLASS", LOG_DEBUG, "No host match (for %s)", c->GetHost().c_str()); continue; } @@ -1124,7 +1124,7 @@ void LocalUser::SetClass(const std::string &explicit_name) */ if (c->limit && (c->GetReferenceCount() >= c->limit)) { - ServerInstance->Logs->Log("CONNECTCLASS", LOG_DEBUG, "OOPS: Connect class limit (%lu) hit, denying", c->limit); + ServerInstance->Logs.Log("CONNECTCLASS", LOG_DEBUG, "OOPS: Connect class limit (%lu) hit, denying", c->limit); continue; } @@ -1134,7 +1134,7 @@ void LocalUser::SetClass(const std::string &explicit_name) /* and our port doesn't match, fail. */ if (!c->ports.count(this->GetServerPort())) { - ServerInstance->Logs->Log("CONNECTCLASS", LOG_DEBUG, "Requires a different port, skipping"); + ServerInstance->Logs.Log("CONNECTCLASS", LOG_DEBUG, "Requires a different port, skipping"); continue; } } @@ -1143,7 +1143,7 @@ void LocalUser::SetClass(const std::string &explicit_name) { if (!ServerInstance->PassCompare(this, c->config->getString("password"), password, c->config->getString("hash"))) { - ServerInstance->Logs->Log("CONNECTCLASS", LOG_DEBUG, "Bad password, skipping"); + ServerInstance->Logs.Log("CONNECTCLASS", LOG_DEBUG, "Bad password, skipping"); continue; } } diff --git a/src/xline.cpp b/src/xline.cpp index 249872740..aeb7256ab 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -538,7 +538,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.Log("BANCACHE", LOG_DEBUG, "BanCache: Adding positive hit (" + line + ") for " + u->GetIPString()); ServerInstance->BanCache.AddHit(u->GetIPString(), this->type, banReason, this->duration); } } |
