diff options
author | aquanight <aquanight@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-02-22 16:47:10 +0000 |
---|---|---|
committer | aquanight <aquanight@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-02-22 16:47:10 +0000 |
commit | da074814501f23680b579feb1ad649c86e8a1348 (patch) | |
tree | 708a5e282425443c3351c0664ed0fa4c2a235eab | |
parent | 07e1c65d9e6419df30a316a3b1f33434ab59f16f (diff) |
Convert remaining InspIRCd::Log() calls to new logging system
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9001 e03df62e-2008-0410-955e-edbf42e46eb7
67 files changed, 295 insertions, 295 deletions
diff --git a/include/modules.h b/include/modules.h index 9498e239e..35c439a10 100644 --- a/include/modules.h +++ b/include/modules.h @@ -135,7 +135,7 @@ typedef std::map<std::string, std::pair<int, modulelist> > interfacelist; } \ catch (CoreException& modexcept) \ { \ - ServerInstance->Log(DEFAULT,"Exception caught: %s",modexcept.GetReason()); \ + ServerInstance->Logs->Log("MODULE",DEFAULT,"Exception caught: %s",modexcept.GetReason()); \ } \ _i = safei; \ } \ @@ -159,7 +159,7 @@ typedef std::map<std::string, std::pair<int, modulelist> > interfacelist; } \ catch (CoreException& modexcept) \ { \ - z->Log(DEFAULT,"Exception caught: %s",modexcept.GetReason()); \ + z->Logs->Log("MODULE",DEFAULT,"Exception caught: %s",modexcept.GetReason()); \ } \ _i = safei; \ } \ @@ -188,7 +188,7 @@ do { \ } \ catch (CoreException& modexcept) \ { \ - ServerInstance->Log(DEFAULT,"Exception caught: %s",modexcept.GetReason()); \ + ServerInstance->Logs->Log("MODULE",DEFAULT,"Exception caught: %s",modexcept.GetReason()); \ } \ _i = safei; \ } \ @@ -218,7 +218,7 @@ do { \ } \ catch (CoreException& modexcept) \ { \ - z->Log(DEBUG,"Exception caught: %s",modexcept.GetReason()); \ + z->Logs->Log("MODULE",DEBUG,"Exception caught: %s",modexcept.GetReason()); \ } \ _i = safei; \ } \ diff --git a/src/channels.cpp b/src/channels.cpp index 793bfb429..c90a8f4e5 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -267,7 +267,7 @@ Channel* Channel::JoinUser(InspIRCd* Instance, User *user, const char* cn, bool if (!IS_LOCAL(user)) { if (!TS) - Instance->Log(DEBUG,"*** BUG *** Channel::JoinUser called for REMOTE user '%s' on channel '%s' but no TS given!", user->nick, cn); + Instance->Logs->Log("CHANNEL",DEBUG,"*** BUG *** Channel::JoinUser called for REMOTE user '%s' on channel '%s' but no TS given!", user->nick, cn); } else { diff --git a/src/command_parse.cpp b/src/command_parse.cpp index 57a86b0cd..d8e59e0c0 100644 --- a/src/command_parse.cpp +++ b/src/command_parse.cpp @@ -426,7 +426,7 @@ bool CommandParser::CreateCommand(Command *f, void* so_handle) RFCCommands[f->command] = so_handle; else { - ServerInstance->Log(DEFAULT,"ERK! Somehow, we loaded a cmd_*.so file twice! Only the first instance is being recorded."); + ServerInstance->Logs->Log("COMMAND",DEFAULT,"ERK! Somehow, we loaded a cmd_*.so file twice! Only the first instance is being recorded."); return false; } } @@ -451,7 +451,7 @@ bool CommandParser::FindSym(void** v, void* h, const std::string &name) const char* err = dlerror(); if (err && !(*v)) { - ServerInstance->Log(SPARSE, "Error loading core command %s: %s\n", name.c_str(), err); + ServerInstance->Logs->Log("COMMAND",SPARSE, "Error loading core command %s: %s\n", name.c_str(), err); return false; } return true; @@ -523,7 +523,7 @@ const char* CommandParser::LoadCommand(const char* name) /* Command already exists? Succeed silently - this is needed for REHASH */ if (RFCCommands.find(name) != RFCCommands.end()) { - ServerInstance->Log(DEBUG,"Not reloading command %s/%s, it already exists", LIBRARYDIR, name); + ServerInstance->Logs->Log("COMMAND",DEBUG,"Not reloading command %s/%s, it already exists", LIBRARYDIR, name); return NULL; } @@ -533,7 +533,7 @@ const char* CommandParser::LoadCommand(const char* name) if (!h) { const char* n = dlerror(); - ServerInstance->Log(SPARSE, "Error loading core command %s: %s", name, n); + ServerInstance->Logs->Log("COMMAND",SPARSE, "Error loading core command %s: %s", name, n); return n; } diff --git a/src/commands/cmd_die.cpp b/src/commands/cmd_die.cpp index 960cefe63..761127dcb 100644 --- a/src/commands/cmd_die.cpp +++ b/src/commands/cmd_die.cpp @@ -27,7 +27,7 @@ CmdResult CommandDie::Handle (const char* const* parameters, int pcnt, User *use if (!ServerInstance->PassCompare(user, ServerInstance->Config->diepass, parameters[0], ServerInstance->Config->powerhash)) { std::string diebuf = std::string("*** DIE command from ") + user->nick + "!" + user->ident + "@" + user->dhost + ". Terminating in " + ConvToStr(ServerInstance->Config->DieDelay) + " seconds."; - ServerInstance->Log(SPARSE, diebuf); + ServerInstance->Logs->Log("COMMAND",SPARSE, diebuf); ServerInstance->SendError(diebuf); if (ServerInstance->Config->DieDelay) @@ -37,7 +37,7 @@ CmdResult CommandDie::Handle (const char* const* parameters, int pcnt, User *use } else { - ServerInstance->Log(SPARSE, "Failed /DIE command from %s!%s@%s", user->nick, user->ident, user->host); + ServerInstance->Logs->Log("COMMAND",SPARSE, "Failed /DIE command from %s!%s@%s", user->nick, user->ident, user->host); ServerInstance->SNO->WriteToSnoMask('A', "Failed DIE Command from %s!%s@%s.",user->nick,user->ident,user->host); return CMD_FAILURE; } diff --git a/src/commands/cmd_kill.cpp b/src/commands/cmd_kill.cpp index c92b8a6b0..72aee4d1d 100644 --- a/src/commands/cmd_kill.cpp +++ b/src/commands/cmd_kill.cpp @@ -86,7 +86,7 @@ CmdResult CommandKill::Handle (const char* const* parameters, int pcnt, User *us * snotices, C will get a local kill snotice. this isn't accurate, and needs fixing at some stage. -- w00t */ ServerInstance->SNO->WriteToSnoMask('k',"Local Kill by %s: %s!%s@%s (%s)", user->nick, u->nick, u->ident, u->host, parameters[1]); - ServerInstance->Log(DEFAULT,"LOCAL KILL: %s :%s!%s!%s (%s)", u->nick, ServerInstance->Config->ServerName, user->dhost, user->nick, parameters[1]); + ServerInstance->Logs->Log("KILL",DEFAULT,"LOCAL KILL: %s :%s!%s!%s (%s)", u->nick, ServerInstance->Config->ServerName, user->dhost, user->nick, parameters[1]); /* Bug #419, make sure this message can only occur once even in the case of multiple KILL messages crossing the network, and change to show * hidekillsserver as source if possible */ diff --git a/src/commands/cmd_oper.cpp b/src/commands/cmd_oper.cpp index 608d04ba6..4acf88329 100644 --- a/src/commands/cmd_oper.cpp +++ b/src/commands/cmd_oper.cpp @@ -84,7 +84,7 @@ CmdResult CommandOper::Handle (const char* const* parameters, int, User *user) { user->WriteServ("491 %s :Invalid oper type (oper types must follow the same syntax as nicknames)",user->nick); ServerInstance->SNO->WriteToSnoMask('o',"CONFIGURATION ERROR! Oper type '%s' contains invalid characters",OperType); - ServerInstance->Log(DEFAULT,"OPER: Failed oper attempt by %s!%s@%s: credentials valid, but oper type erroneous.",user->nick,user->ident,user->host); + ServerInstance->Logs->Log("OPER",DEFAULT,"OPER: Failed oper attempt by %s!%s@%s: credentials valid, but oper type erroneous.",user->nick,user->ident,user->host); return CMD_FAILURE; } ServerInstance->Config->ConfValue(ServerInstance->Config->config_data, "type","host", j, HostName, MAXBUF); @@ -141,7 +141,7 @@ CmdResult CommandOper::Handle (const char* const* parameters, int, User *user) Event rmode2((char *)&n, NULL, "send_snoset"); rmode2.Send(ServerInstance); - ServerInstance->Log(DEFAULT,"OPER: Failed oper attempt by %s!%s@%s using login '%s': The following fields did not match: %s",user->nick,user->ident,user->host,parameters[0],fields.c_str()); + ServerInstance->Logs->Log("OPER",DEFAULT,"OPER: Failed oper attempt by %s!%s@%s using login '%s': The following fields did not match: %s",user->nick,user->ident,user->host,parameters[0],fields.c_str()); return CMD_FAILURE; } else @@ -155,7 +155,7 @@ CmdResult CommandOper::Handle (const char* const* parameters, int, User *user) Event rmode2((char *)&n, NULL, "send_snoset"); rmode2.Send(ServerInstance); - ServerInstance->Log(DEFAULT,"OPER: Failed oper attempt by %s!%s@%s using login '%s': credentials valid, but oper type nonexistent.",user->nick,user->ident,user->host,parameters[0]); + ServerInstance->Logs->Log("OPER",DEFAULT,"OPER: Failed oper attempt by %s!%s@%s using login '%s': credentials valid, but oper type nonexistent.",user->nick,user->ident,user->host,parameters[0]); return CMD_FAILURE; } } diff --git a/src/commands/cmd_restart.cpp b/src/commands/cmd_restart.cpp index 379052a1e..cc634d860 100644 --- a/src/commands/cmd_restart.cpp +++ b/src/commands/cmd_restart.cpp @@ -21,7 +21,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance) CmdResult CommandRestart::Handle (const char* const* parameters, int, User *user) { - ServerInstance->Log(DEFAULT,"Restart: %s",user->nick); + ServerInstance->Logs->Log("COMMAND",DEFAULT,"Restart: %s",user->nick); if (!ServerInstance->PassCompare(user, ServerInstance->Config->restartpass, parameters[0], ServerInstance->Config->powerhash)) { ServerInstance->SNO->WriteToSnoMask('A', "RESTART command from %s!%s@%s, restarting server.",user->nick,user->ident,user->host); diff --git a/src/commands/cmd_whowas.cpp b/src/commands/cmd_whowas.cpp index fd9544853..cece27670 100644 --- a/src/commands/cmd_whowas.cpp +++ b/src/commands/cmd_whowas.cpp @@ -207,7 +207,7 @@ void CommandWhowas::PruneWhoWas(time_t t) if (iter == whowas.end()) { /* this should never happen, if it does maps are corrupt */ - ServerInstance->Log(DEFAULT, "BUG: Whowas maps got corrupted! (1)"); + ServerInstance->Logs->Log("WHOWAS",DEFAULT, "BUG: Whowas maps got corrupted! (1)"); return; } @@ -240,7 +240,7 @@ void CommandWhowas::PruneWhoWas(time_t t) if (iter == whowas.end()) { /* this should never happen, if it does maps are corrupt */ - ServerInstance->Log(DEFAULT, "BUG: Whowas maps got corrupted! (2)"); + ServerInstance->Logs->Log("WHOWAS",DEFAULT, "BUG: Whowas maps got corrupted! (2)"); return; } whowas_set* n = (whowas_set*)iter->second; @@ -293,7 +293,7 @@ CommandWhowas::~CommandWhowas() if (iter == whowas.end()) { /* this should never happen, if it does maps are corrupt */ - ServerInstance->Log(DEFAULT, "BUG: Whowas maps got corrupted! (3)"); + ServerInstance->Logs->Log("WHOWAS",DEFAULT, "BUG: Whowas maps got corrupted! (3)"); return; } diff --git a/src/configreader.cpp b/src/configreader.cpp index e0dd021ba..92d2c9aea 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -284,7 +284,7 @@ bool ValidateMaxTargets(ServerConfig* conf, const char*, const char*, ValueItem { if ((data.GetInteger() < 0) || (data.GetInteger() > 31)) { - conf->GetInstance()->Log(DEFAULT,"WARNING: <options:maxtargets> value is greater than 31 or less than 0, set to 20."); + conf->GetInstance()->Logs->Log("CONFIG",DEFAULT,"WARNING: <options:maxtargets> value is greater than 31 or less than 0, set to 20."); data.Set(20); } return true; @@ -294,7 +294,7 @@ bool ValidateSoftLimit(ServerConfig* conf, const char*, const char*, ValueItem & { if ((data.GetInteger() < 1) || (data.GetInteger() > MAXCLIENTS)) { - conf->GetInstance()->Log(DEFAULT,"WARNING: <options:softlimit> value is greater than %d or less than 0, set to %d.",MAXCLIENTS,MAXCLIENTS); + conf->GetInstance()->Logs->Log("CONFIG",DEFAULT,"WARNING: <options:softlimit> value is greater than %d or less than 0, set to %d.",MAXCLIENTS,MAXCLIENTS); data.Set(MAXCLIENTS); } return true; @@ -303,7 +303,7 @@ bool ValidateSoftLimit(ServerConfig* conf, const char*, const char*, ValueItem & bool ValidateMaxConn(ServerConfig* conf, const char*, const char*, ValueItem &data) { if (data.GetInteger() > SOMAXCONN) - conf->GetInstance()->Log(DEFAULT,"WARNING: <options:somaxconn> value may be higher than the system-defined SOMAXCONN value!"); + conf->GetInstance()->Logs->Log("CONFIG",DEFAULT,"WARNING: <options:somaxconn> value may be higher than the system-defined SOMAXCONN value!"); return true; } @@ -334,7 +334,7 @@ bool ValidateDnsServer(ServerConfig* conf, const char*, const char*, ValueItem & { std::string nameserver; // attempt to look up their nameserver from /etc/resolv.conf - conf->GetInstance()->Log(DEFAULT,"WARNING: <dns:server> not defined, attempting to find working server in /etc/resolv.conf..."); + conf->GetInstance()->Logs->Log("CONFIG",DEFAULT,"WARNING: <dns:server> not defined, attempting to find working server in /etc/resolv.conf..."); std::ifstream resolv("/etc/resolv.conf"); bool found_server = false; @@ -347,19 +347,19 @@ bool ValidateDnsServer(ServerConfig* conf, const char*, const char*, ValueItem & resolv >> nameserver; data.Set(nameserver.c_str()); found_server = true; - conf->GetInstance()->Log(DEFAULT,"<dns:server> set to '%s' as first resolver in /etc/resolv.conf.",nameserver.c_str()); + conf->GetInstance()->Logs->Log("CONFIG",DEFAULT,"<dns:server> set to '%s' as first resolver in /etc/resolv.conf.",nameserver.c_str()); } } if (!found_server) { - conf->GetInstance()->Log(DEFAULT,"/etc/resolv.conf contains no viable nameserver entries! Defaulting to nameserver '127.0.0.1'!"); + conf->GetInstance()->Logs->Log("CONFIG",DEFAULT,"/etc/resolv.conf contains no viable nameserver entries! Defaulting to nameserver '127.0.0.1'!"); data.Set("127.0.0.1"); } } else { - conf->GetInstance()->Log(DEFAULT,"/etc/resolv.conf can't be opened! Defaulting to nameserver '127.0.0.1'!"); + conf->GetInstance()->Logs->Log("CONFIG",DEFAULT,"/etc/resolv.conf can't be opened! Defaulting to nameserver '127.0.0.1'!"); data.Set("127.0.0.1"); } } @@ -377,7 +377,7 @@ bool ValidateServerName(ServerConfig* conf, const char*, const char*, ValueItem } if (!strchr(data.GetString(),'.')) { - conf->GetInstance()->Log(DEFAULT,"WARNING: <server:name> '%s' is not a fully-qualified domain name. Changed to '%s%c'",data.GetString(),data.GetString(),'.'); + conf->GetInstance()->Logs->Log("CONFIG",DEFAULT,"WARNING: <server:name> '%s' is not a fully-qualified domain name. Changed to '%s%c'",data.GetString(),data.GetString(),'.'); std::string moo = std::string(data.GetString()).append("."); data.Set(moo.c_str()); } @@ -388,7 +388,7 @@ bool ValidateNetBufferSize(ServerConfig* conf, const char*, const char*, ValueIt { if ((!data.GetInteger()) || (data.GetInteger() > 65535) || (data.GetInteger() < 1024)) { - conf->GetInstance()->Log(DEFAULT,"No NetBufferSize specified or size out of range, setting to default of 10240."); + conf->GetInstance()->Logs->Log("CONFIG",DEFAULT,"No NetBufferSize specified or size out of range, setting to default of 10240."); data.Set(10240); } return true; @@ -398,7 +398,7 @@ bool ValidateMaxWho(ServerConfig* conf, const char*, const char*, ValueItem &dat { if ((data.GetInteger() > 65535) || (data.GetInteger() < 1)) { - conf->GetInstance()->Log(DEFAULT,"<options:maxwhoresults> size out of range, setting to default of 128."); + conf->GetInstance()->Logs->Log("CONFIG",DEFAULT,"<options:maxwhoresults> size out of range, setting to default of 128."); data.Set(128); } return true; @@ -501,7 +501,7 @@ bool ValidateWhoWas(ServerConfig* conf, const char*, const char*, ValueItem &dat if (conf->WhoWasMaxKeep < 3600) { conf->WhoWasMaxKeep = 3600; - conf->GetInstance()->Log(DEFAULT,"WARNING: <whowas:maxkeep> value less than 3600, setting to default 3600"); + conf->GetInstance()->Logs->Log("CONFIG",DEFAULT,"WARNING: <whowas:maxkeep> value less than 3600, setting to default 3600"); } Command* whowas_command = conf->GetInstance()->Parser->GetHandler("WHOWAS"); @@ -518,13 +518,13 @@ bool ValidateWhoWas(ServerConfig* conf, const char*, const char*, ValueItem &dat */ bool InitConnect(ServerConfig* conf, const char*) { - conf->GetInstance()->Log(DEFAULT,"Reading connect classes..."); + conf->GetInstance()->Logs->Log("CONFIG",DEFAULT,"Reading connect classes..."); for (ClassVector::iterator i = conf->Classes.begin(); i != conf->Classes.end(); i++) { ConnectClass *c = *i; - conf->GetInstance()->Log(DEBUG, "Address of class is %p", c); + conf->GetInstance()->Logs->Log("CONFIG",DEBUG, "Address of class is %p", c); } for (ClassVector::iterator i = conf->Classes.begin(); i != conf->Classes.end() ; ) @@ -534,7 +534,7 @@ bool InitConnect(ServerConfig* conf, const char*) /* only delete a class with refcount 0 */ if (c->RefCount == 0) { - conf->GetInstance()->Log(DEFAULT, "Removing connect class, refcount is 0!"); + conf->GetInstance()->Logs->Log("CONFIG",DEFAULT, "Removing connect class, refcount is 0!"); /* This was causing a crash, because we'd set i to .begin() just here, but then the for loop's increment would * set it to .begin() + 1. Which if it was already the last thing in the list, wasn't good. @@ -588,12 +588,12 @@ bool DoConnect(ServerConfig* conf, const char*, char**, ValueList &values, int*) { /* reenable class so users can be shoved into it :P */ cc->SetDisabled(false); - conf->GetInstance()->Log(DEFAULT, "Not adding class, it already exists!"); + conf->GetInstance()->Logs->Log("CONFIG",DEFAULT, "Not adding class, it already exists!"); return true; } } - conf->GetInstance()->Log(DEFAULT,"Adding a connect class!"); + conf->GetInstance()->Logs->Log("CONFIG",DEFAULT,"Adding a connect class!"); if (*parent) { @@ -604,7 +604,7 @@ bool DoConnect(ServerConfig* conf, const char*, char**, ValueList &values, int*) for (; item != conf->Classes.end(); ++item) { ConnectClass* cc = *item; - conf->GetInstance()->Log(DEBUG,"Class: %s", cc->GetName().c_str()); + conf->GetInstance()->Logs->Log("CONFIG",DEBUG,"Class: %s", cc->GetName().c_str()); if (cc->GetName() == parent) { ConnectClass* newclass = new ConnectClass(name, cc); @@ -640,7 +640,7 @@ bool DoConnect(ServerConfig* conf, const char*, char**, ValueList &values, int*) */ bool DoneConnect(ServerConfig *conf, const char*) { - conf->GetInstance()->Log(DEFAULT, "Done adding connect classes!"); + conf->GetInstance()->Logs->Log("CONFIG",DEFAULT, "Done adding connect classes!"); return true; } @@ -751,7 +751,7 @@ bool DoneMaxBans(ServerConfig*, const char*) void ServerConfig::ReportConfigError(const std::string &errormessage, bool bail, User* user) { - ServerInstance->Log(DEFAULT, "There were errors in your configuration file: %s", errormessage.c_str()); + ServerInstance->Logs->Log("CONFIG",DEFAULT, "There were errors in your configuration file: %s", errormessage.c_str()); if (bail) { /* Unneeded because of the ServerInstance->Log() aboive? */ @@ -1146,7 +1146,7 @@ void ServerConfig::Read(bool bail, User* user, int pass) } /** XXX END PASS **/ - ServerInstance->Log(DEBUG,"End config pass %d", pass); + ServerInstance->Logs->Log("CONFIG",DEBUG,"End config pass %d", pass); if (pass == 0) { @@ -1157,7 +1157,7 @@ void ServerConfig::Read(bool bail, User* user, int pass) if (pass == 0) { - ServerInstance->Log(DEBUG, "Downloading configuration"); + ServerInstance->Logs->Log("CONFIG",DEBUG, "Downloading configuration"); TotalDownloaded = 0; FileErrors = 0; @@ -1189,7 +1189,7 @@ void ServerConfig::Read(bool bail, User* user, int pass) // write once here, to try it out and make sure its ok ServerInstance->WritePID(this->PID); - ServerInstance->Log(DEFAULT,"Done reading configuration file."); + ServerInstance->Logs->Log("CONFIG",DEFAULT,"Done reading configuration file."); /* If we're rehashing, let's load any new modules, and unload old ones */ @@ -1263,7 +1263,7 @@ void ServerConfig::Read(bool bail, User* user, int pass) } } - ServerInstance->Log(DEFAULT,"Successfully unloaded %lu of %lu modules and loaded %lu of %lu modules.",(unsigned long)rem,(unsigned long)removed_modules.size(),(unsigned long)add,(unsigned long)added_modules.size()); + ServerInstance->Logs->Log("CONFIG",DEFAULT,"Successfully unloaded %lu of %lu modules and loaded %lu of %lu modules.",(unsigned long)rem,(unsigned long)removed_modules.size(),(unsigned long)add,(unsigned long)added_modules.size()); if (user) user->WriteServ("NOTICE %s :*** Successfully rehashed server.", user->nick); @@ -1274,7 +1274,7 @@ void ServerConfig::Read(bool bail, User* user, int pass) /* XXX: This can and will block! */ void ServerConfig::DoDownloads() { - ServerInstance->Log(DEBUG,"In DoDownloads()"); + ServerInstance->Logs->Log("CONFIG",DEBUG,"In DoDownloads()"); /* Reads all local files into the IncludedFiles map, then initiates sockets for the remote ones */ for (std::map<std::string, std::istream*>::iterator x = IncludedFiles.begin(); x != IncludedFiles.end(); ++x) @@ -1282,7 +1282,7 @@ void ServerConfig::DoDownloads() if (CompletedFiles.find(x->first) != CompletedFiles.end()) continue; - ServerInstance->Log(DEBUG,"StartDownloads File: %s", x->first.c_str()); + ServerInstance->Logs->Log("CONFIG",DEBUG,"StartDownloads File: %s", x->first.c_str()); std::string file = x->first; if ((file[0] == '/') || (file.substr(0, 7) == "file://")) @@ -1295,7 +1295,7 @@ void ServerConfig::DoDownloads() std::ifstream* conf = new std::ifstream(file.c_str()); if (!conf->fail()) { - ServerInstance->Log(DEBUG,"file:// schema file %s loaded OK", file.c_str()); + ServerInstance->Logs->Log("CONFIG",DEBUG,"file:// schema file %s loaded OK", file.c_str()); delete x->second; x->second = conf; } @@ -1310,7 +1310,7 @@ void ServerConfig::DoDownloads() else { /* Modules handle these */ - ServerInstance->Log(DEBUG,"Module-handled schema for %s", x->first.c_str()); + ServerInstance->Logs->Log("CONFIG",DEBUG,"Module-handled schema for %s", x->first.c_str()); /* For now, error it */ int MOD_RESULT = 0; @@ -1350,7 +1350,7 @@ bool ServerConfig::LoadConf(ConfigDataHash &target, const char* filename, std::o if (scan_for_includes_only) { - ServerInstance->Log(DEBUG,"scan_for_includes_only set"); + ServerInstance->Logs->Log("CONFIG",DEBUG,"scan_for_includes_only set"); conf = scan_for_includes_only; } @@ -1373,7 +1373,7 @@ bool ServerConfig::LoadConf(ConfigDataHash &target, const char* filename, std::o { if (pass == 0) { - ServerInstance->Log(DEBUG,"Push include file %s onto map", filename); + ServerInstance->Logs->Log("CONFIG",DEBUG,"Push include file %s onto map", filename); /* First pass, we insert the file into a map, and just return true */ IncludedFiles.insert(std::make_pair(filename,new std::stringstream)); return true; @@ -1381,7 +1381,7 @@ bool ServerConfig::LoadConf(ConfigDataHash &target, const char* filename, std::o else { /* Second pass, look for the file in the map */ - ServerInstance->Log(DEBUG,"We are in the second pass, and %s is not in the map!", filename); + ServerInstance->Logs->Log("CONFIG",DEBUG,"We are in the second pass, and %s is not in the map!", filename); errorstream << "File " << filename << " could not be opened." << std::endl; return false; } @@ -1401,7 +1401,7 @@ bool ServerConfig::LoadConf(ConfigDataHash &target, const char* filename, std::o } } - ServerInstance->Log(DEBUG,"Start to read conf %s %08lx", filename, conf); + ServerInstance->Logs->Log("CONFIG",DEBUG,"Start to read conf %s %08lx", filename, conf); /* Start reading characters... */ while (conf->get(ch)) @@ -1779,7 +1779,7 @@ bool ServerConfig::ConfValue(ConfigDataHash &target, const std::string &tag, con { if ((!allow_linefeeds) && (j->second.find('\n') != std::string::npos)) { - ServerInstance->Log(DEFAULT, "Value of <" + tag + ":" + var+ "> contains a linefeed, and linefeeds in this value are not permitted -- stripped to spaces."); + ServerInstance->Logs->Log("CONFIG",DEFAULT, "Value of <" + tag + ":" + var+ "> contains a linefeed, and linefeeds in this value are not permitted -- stripped to spaces."); for (std::string::iterator n = j->second.begin(); n != j->second.end(); n++) if (*n == '\n') *n = ' '; diff --git a/src/cull_list.cpp b/src/cull_list.cpp index b3fd1c9e3..224591b6f 100644 --- a/src/cull_list.cpp +++ b/src/cull_list.cpp @@ -25,7 +25,7 @@ void CullList::AddItem(User* user) { if (user->quitting) { - ServerInstance->Log(DEBUG, "*** Warning *** - You tried to quit a user (%s) twice. Did your module call QuitUser twice?", user->nick); + ServerInstance->Logs->Log("CULLLIST",DEBUG, "*** Warning *** - You tried to quit a user (%s) twice. Did your module call QuitUser twice?", user->nick); return; } @@ -88,7 +88,7 @@ int CullList::Apply() } catch (CoreException& modexcept) { - ServerInstance->Log(DEBUG, "%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason()); + ServerInstance->Logs->Log("CULLLIST",DEBUG, "%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason()); } } diff --git a/src/dns.cpp b/src/dns.cpp index 0d822a17d..447b90781 100644 --- a/src/dns.cpp +++ b/src/dns.cpp @@ -213,7 +213,7 @@ inline void DNS::EmptyHeader(unsigned char *output, const DNSHeader *header, con /** Send requests we have previously built down the UDP socket */ int DNSRequest::SendRequests(const DNSHeader *header, const int length, QueryType qt) { - ServerInstance->Log(DEBUG,"DNSRequest::SendRequests"); + ServerInstance->Logs->Log("RESOLVER", DEBUG,"DNSRequest::SendRequests"); unsigned char payload[sizeof(DNSHeader)]; @@ -245,7 +245,7 @@ int DNSRequest::SendRequests(const DNSHeader *header, const int length, QueryTyp return -1; } - ServerInstance->Log(DEBUG,"Sent OK"); + ServerInstance->Logs->Log("RESOLVER",DEBUG,"Sent OK"); return 0; } @@ -332,9 +332,9 @@ void DNS::Rehash() if ((strstr(ServerInstance->Config->DNSServer,"::ffff:") == (char*)&ServerInstance->Config->DNSServer) || (strstr(ServerInstance->Config->DNSServer,"::FFFF:") == (char*)&ServerInstance->Config->DNSServer)) { - ServerInstance->Log(DEFAULT,"WARNING: Using IPv4 addresses over IPv6 forces some DNS checks to be disabled."); - ServerInstance->Log(DEFAULT," This should not cause a problem, however it is recommended you migrate"); - ServerInstance->Log(DEFAULT," to a true IPv6 environment."); + ServerInstance->Logs->Log("RESOLVER",DEFAULT,"WARNING: Using IPv4 addresses over IPv6 forces some DNS checks to be disabled."); + ServerInstance->Logs->Log("RESOLVER",DEFAULT," This should not cause a problem, however it is recommended you migrate"); + ServerInstance->Logs->Log("RESOLVER",DEFAULT," to a true IPv6 environment."); this->ip6munge = true; } @@ -366,7 +366,7 @@ void DNS::Rehash() if (!ServerInstance->BindSocket(this->GetFd(), portpass, "", false)) { /* Failed to bind */ - ServerInstance->Log(DEBUG,"Error binding dns socket"); + ServerInstance->Logs->Log("RESOLVER",DEBUG,"Error binding dns socket"); ServerInstance->SE->Shutdown(this, 2); ServerInstance->SE->Close(this); this->SetFd(-1); @@ -379,7 +379,7 @@ void DNS::Rehash() { if (!ServerInstance->SE->AddFd(this)) { - ServerInstance->Log(DEFAULT,"Internal error starting DNS - hostnames will NOT resolve."); + ServerInstance->Logs->Log("RESOLVER",DEFAULT,"Internal error starting DNS - hostnames will NOT resolve."); ServerInstance->SE->Shutdown(this, 2); ServerInstance->SE->Close(this); this->SetFd(-1); @@ -389,14 +389,14 @@ void DNS::Rehash() } else { - ServerInstance->Log(DEBUG,"Error creating dns socket"); + ServerInstance->Logs->Log("RESOLVER",DEBUG,"Error creating dns socket"); } } /** Initialise the DNS UDP socket so that we can send requests */ DNS::DNS(InspIRCd* Instance) : ServerInstance(Instance) { - ServerInstance->Log(DEBUG,"DNS::DNS"); + ServerInstance->Logs->Log("RESOLVER",DEBUG,"DNS::DNS"); /* Clear the Resolver class table */ memset(Classes,0,sizeof(Classes)); @@ -959,7 +959,7 @@ void Resolver::TriggerCachedResult() /** High level abstraction of dns used by application at large */ Resolver::Resolver(InspIRCd* Instance, const std::string &source, QueryType qt, bool &cached, Module* creator) : ServerInstance(Instance), Creator(creator), input(source), querytype(qt) { - ServerInstance->Log(DEBUG,"Resolver::Resolver"); + ServerInstance->Logs->Log("RESOLVER",DEBUG,"Resolver::Resolver"); cached = false; CQ = ServerInstance->Res->GetCache(source); @@ -1030,7 +1030,7 @@ Resolver::Resolver(InspIRCd* Instance, const std::string &source, QueryType qt, } else { - ServerInstance->Log(DEBUG,"DNS request id %d", this->myid); + ServerInstance->Logs->Log("RESOLVER",DEBUG,"DNS request id %d", this->myid); } } @@ -1064,11 +1064,11 @@ void DNS::HandleEvent(EventType, int) int resultnum = 0; DNSResult res(0,"",0,""); res.id = 0; - ServerInstance->Log(DEBUG,"Handle DNS event"); + ServerInstance->Logs->Log("RESOLVER",DEBUG,"Handle DNS event"); res = this->GetResult(resultnum); - ServerInstance->Log(DEBUG,"Result %d id %d", resultnum, res.id); + ServerInstance->Logs->Log("RESOLVER",DEBUG,"Result %d id %d", resultnum, res.id); /* Is there a usable request id? */ if (res.id != -1) @@ -1116,7 +1116,7 @@ void DNS::HandleEvent(EventType, int) /** Add a derived Resolver to the working set */ bool DNS::AddResolverClass(Resolver* r) { - ServerInstance->Log(DEBUG,"AddResolverClass %08lx", r); + ServerInstance->Logs->Log("RESOLVER",DEBUG,"AddResolverClass %08lx", r); /* Check the pointers validity and the id's validity */ if ((r) && (r->GetId() > -1)) { diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp index 487af4511..465f55d6f 100644 --- a/src/helperfuncs.cpp +++ b/src/helperfuncs.cpp @@ -342,7 +342,7 @@ void InspIRCd::CheckRoot() if (geteuid() == 0) { printf("WARNING!!! You are running an irc server as ROOT!!! DO NOT DO THIS!!!\n\n"); - this->Log(DEFAULT,"Cant start as root"); + this->Logs->Log("STARTUP",DEFAULT,"Cant start as root"); Exit(EXIT_STATUS_ROOT); } } @@ -352,7 +352,7 @@ void InspIRCd::CheckDie() if (*Config->DieValue) { printf("WARNING: %s\n\n",Config->DieValue); - this->Log(DEFAULT,"Died because of <die> tag: %s",Config->DieValue); + this->Logs->Log("CONFIG",DEFAULT,"Died because of <die> tag: %s",Config->DieValue); Exit(EXIT_STATUS_DIETAG); } } diff --git a/src/inspircd.cpp b/src/inspircd.cpp index d1af4188c..8999e7ccc 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -232,14 +232,14 @@ bool InspIRCd::DaemonSeed() rlimit rl; if (getrlimit(RLIMIT_CORE, &rl) == -1) { - this->Log(DEFAULT,"Failed to getrlimit()!"); + this->Logs->Log("STARTUP",DEFAULT,"Failed to getrlimit()!"); return false; } else { rl.rlim_cur = rl.rlim_max; if (setrlimit(RLIMIT_CORE, &rl) == -1) - this->Log(DEFAULT,"setrlimit() failed, cannot increase coredump size."); + this->Logs->Log("STARTUP",DEFAULT,"setrlimit() failed, cannot increase coredump size."); } return true; @@ -268,7 +268,7 @@ void InspIRCd::WritePID(const std::string &filename) else { printf("Failed to write PID-file '%s', exiting.\n",fname.c_str()); - this->Log(DEFAULT,"Failed to write PID-file '%s', exiting.",fname.c_str()); + this->Logs->Log("STARTUP",DEFAULT,"Failed to write PID-file '%s', exiting.",fname.c_str()); Exit(EXIT_STATUS_PID); } } @@ -426,7 +426,7 @@ InspIRCd::InspIRCd(int argc, char** argv) if (!ServerConfig::FileExists(this->ConfigFileName)) { printf("ERROR: Cannot open config file: %s\nExiting...\n", this->ConfigFileName); - this->Log(DEFAULT,"Unable to open config file %s", this->ConfigFileName); + this->Logs->Log("STARTUP",DEFAULT,"Unable to open config file %s", this->ConfigFileName); Exit(EXIT_STATUS_CONFIG); } @@ -704,7 +704,7 @@ void InspIRCd::BufferedSocketCull() { for (std::map<BufferedSocket*,BufferedSocket*>::iterator x = SocketCull.begin(); x != SocketCull.end(); ++x) { - Log(DEBUG,"Cull socket"); + this->Logs->Log("MISC",DEBUG,"Cull socket"); SE->DelFd(x->second); x->second->Close(); delete x->second; diff --git a/src/inspsocket.cpp b/src/inspsocket.cpp index 17aaa220d..41f40dc2b 100644 --- a/src/inspsocket.cpp +++ b/src/inspsocket.cpp @@ -116,7 +116,7 @@ BufferedSocket::BufferedSocket(InspIRCd* SI, const std::string &ipaddr, int apor } if (!ipvalid) { - this->Instance->Log(DEBUG,"BUG: Hostname passed to BufferedSocket, rather than an IP address!"); + this->Instance->Logs->Log("SOCKET", DEBUG,"BUG: Hostname passed to BufferedSocket, rather than an IP address!"); this->OnError(I_ERR_CONNECT); this->Close(); this->fd = -1; @@ -236,7 +236,7 @@ bool BufferedSocket::BindAddr(const std::string &ip) } j++; } - Instance->Log(DEBUG,"nothing in the config to bind()!"); + Instance->Logs->Log("SOCKET", DEBUG,"nothing in the config to bind()!"); return true; } @@ -345,7 +345,7 @@ bool BufferedSocket::DoConnect() this->SetQueues(this->fd); } - Instance->Log(DEBUG,"BufferedSocket::DoConnect success"); + Instance->Logs->Log("SOCKET", DEBUG,"BufferedSocket::DoConnect success"); return true; } @@ -367,7 +367,7 @@ void BufferedSocket::Close() } catch (CoreException& modexcept) { - Instance->Log(DEFAULT,"%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason()); + Instance->Logs->Log("SOCKET", DEFAULT,"%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason()); } } Instance->SE->Shutdown(this, 2); @@ -402,7 +402,7 @@ const char* BufferedSocket::Read() } catch (CoreException& modexcept) { - Instance->Log(DEFAULT,"%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason()); + Instance->Logs->Log("SOCKET", DEFAULT,"%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason()); } if (MOD_RESULT < 0) { @@ -470,7 +470,7 @@ bool BufferedSocket::FlushWriteBuffer() } catch (CoreException& modexcept) { - Instance->Log(DEBUG,"%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason()); + Instance->Logs->Log("SOCKET", DEBUG,"%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason()); return true; } } @@ -536,7 +536,7 @@ bool BufferedSocket::FlushWriteBuffer() void SocketTimeout::Tick(time_t) { - ServerInstance->Log(DEBUG,"SocketTimeout::Tick"); + ServerInstance->Logs->Log("SOCKET", DEBUG,"SocketTimeout::Tick"); if (ServerInstance->SE->GetRef(this->sfd) != this->sock) return; @@ -594,14 +594,14 @@ bool BufferedSocket::Poll() if (Instance->Config->GetIOHook(this)) { - Instance->Log(DEBUG,"Hook for raw connect"); + Instance->Logs->Log("SOCKET",DEBUG,"Hook for raw connect"); try { Instance->Config->GetIOHook(this)->OnRawSocketConnect(this->fd); } catch (CoreException& modexcept) { - Instance->Log(DEBUG,"%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason()); + Instance->Logs->Log("SOCKET",DEBUG,"%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason()); } } return this->OnConnected(); @@ -643,7 +643,7 @@ bool BufferedSocket::Poll() } catch (CoreException& modexcept) { - Instance->Log(DEBUG,"%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason()); + Instance->Logs->Log("SOCKET",DEBUG,"%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason()); } } diff --git a/src/mode.cpp b/src/mode.cpp index 5a0cdbf1e..b3f05bd37 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -91,7 +91,7 @@ unsigned int ModeHandler::GetCount() void ModeHandler::ChangeCount(int modifier) { count += modifier; - ServerInstance->Log(DEBUG,"Change count for mode %c is now %d", mode, count); + ServerInstance->Logs->Log("MODE", DEBUG,"Change count for mode %c is now %d", mode, count); } ModeType ModeHandler::GetModeType() @@ -521,13 +521,13 @@ void ModeParser::Process(const char* const* parameters, int pcnt, User *user, bo if (!SkipAccessChecks && IS_LOCAL(user) && (MOD_RESULT != ACR_ALLOW)) { - ServerInstance->Log(DEBUG,"Enter minimum prefix check"); + ServerInstance->Logs->Log("MODE", DEBUG,"Enter minimum prefix check"); /* Check access to this mode character */ if ((type == MODETYPE_CHANNEL) && (modehandlers[handler_id]->GetNeededPrefix())) { char needed = modehandlers[handler_id]->GetNeededPrefix(); ModeHandler* prefixmode = FindPrefix(needed); - ServerInstance->Log(DEBUG,"Needed prefix: %c", needed); + ServerInstance->Logs->Log("MODE", DEBUG,"Needed prefix: %c", needed); /* If the mode defined by the handler is not '\0', but the handler for it * cannot be found, they probably dont have the right module loaded to implement diff --git a/src/modes/cmode_b.cpp b/src/modes/cmode_b.cpp index bedd4b6b6..57aa3e950 100644 --- a/src/modes/cmode_b.cpp +++ b/src/modes/cmode_b.cpp @@ -91,7 +91,7 @@ std::string& ModeChannelBan::AddBan(User *user, std::string &dest, Channel *chan { if ((!user) || (!chan)) { - ServerInstance->Log(DEFAULT,"*** BUG *** AddBan was given an invalid parameter"); + ServerInstance->Logs->Log("MODE",DEFAULT,"*** BUG *** AddBan was given an invalid parameter"); dest = ""; return dest; } @@ -151,7 +151,7 @@ std::string& ModeChannelBan::DelBan(User *user, std::string& dest, Channel *chan { if ((!user) || (!chan)) { - ServerInstance->Log(DEFAULT,"*** BUG *** TakeBan was given an invalid parameter"); + ServerInstance->Logs->Log("MODE",DEFAULT,"*** BUG *** TakeBan was given an invalid parameter"); dest = ""; return dest; } diff --git a/src/modules.cpp b/src/modules.cpp index ba98ad865..3e7ae9cdf 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -381,21 +381,21 @@ bool ModuleManager::Load(const char* filename) if (!ServerConfig::DirValid(modfile)) { LastModuleError = "Module " + filename_str + " is not within the modules directory."; - Instance->Log(DEFAULT, LastModuleError); + Instance->Logs->Log("MODULE", DEFAULT, LastModuleError); return false; } if (!ServerConfig::FileExists(modfile)) { LastModuleError = "Module file could not be found: " + filename_str; - Instance->Log(DEFAULT, LastModuleError); + Instance->Logs->Log("MODULE", DEFAULT, LastModuleError); return false; } if (Modules.find(filename_str) != Modules.end()) { LastModuleError = "Module " + filename_str + " is already loaded, cannot load a module twice!"; - Instance->Log(DEFAULT, LastModuleError); + Instance->Logs->Log("MODULE", DEFAULT, LastModuleError); return false; } @@ -420,12 +420,12 @@ bool ModuleManager::Load(const char* filename) delete newmod; delete newhandle; LastModuleError = "Unable to load " + filename_str + ": Incorrect module API version: " + ConvToStr(v.API) + " (our version: " + ConvToStr(API_VERSION) + ")"; - Instance->Log(DEFAULT, LastModuleError); + Instance->Logs->Log("MODULE", DEFAULT, LastModuleError); return false; } else { - Instance->Log(DEFAULT,"New module introduced: %s (API version %d, Module version %d.%d.%d.%d)%s", filename, v.API, v.Major, v.Minor, v.Revision, v.Build, (!(v.Flags & VF_VENDOR) ? " [3rd Party]" : " [Vendor]")); + Instance->Logs->Log("MODULE", DEFAULT,"New module introduced: %s (API version %d, Module version %d.%d.%d.%d)%s", filename, v.API, v.Major, v.Minor, v.Revision, v.Build, (!(v.Flags & VF_VENDOR) ? " [3rd Party]" : " [Vendor]")); } Modules[filename_str] = std::make_pair(newhandle, newmod); @@ -434,7 +434,7 @@ bool ModuleManager::Load(const char* filename) { delete newhandle; LastModuleError = "Unable to load " + filename_str + ": Probably missing init_module() entrypoint, but dlsym() didn't notice a problem"; - Instance->Log(DEFAULT, LastModuleError); + Instance->Logs->Log("MODULE", DEFAULT, LastModuleError); return false; } } @@ -447,7 +447,7 @@ bool ModuleManager::Load(const char* filename) if (newhandle) delete newhandle; LastModuleError = "Unable to load " + filename_str + ": Error when loading: " + modexcept.GetReason(); - Instance->Log(DEFAULT, LastModuleError); + Instance->Logs->Log("MODULE", DEFAULT, LastModuleError); return false; } catch (FindSymbolException& modexcept) @@ -458,7 +458,7 @@ bool ModuleManager::Load(const char* filename) if (newhandle) delete newhandle; LastModuleError = "Unable to load " + filename_str + ": Error finding symbol: " + modexcept.GetReason(); - Instance->Log(DEFAULT, LastModuleError); + Instance->Logs->Log("MODULE", DEFAULT, LastModuleError); return false; } catch (CoreException& modexcept) @@ -469,7 +469,7 @@ bool ModuleManager::Load(const char* filename) if (newhandle) delete newhandle; LastModuleError = "Unable to load " + filename_str + ": " + modexcept.GetReason(); - Instance->Log(DEFAULT, LastModuleError); + Instance->Logs->Log("MODULE", DEFAULT, LastModuleError); return false; } @@ -497,14 +497,14 @@ bool ModuleManager::Unload(const char* filename) if (modfind->second.second->GetVersion().Flags & VF_STATIC) { LastModuleError = "Module " + filename_str + " not unloadable (marked static)"; - Instance->Log(DEFAULT, LastModuleError); + Instance->Logs->Log("MODULE", DEFAULT, LastModuleError); return false; } std::pair<int,std::string> intercount = GetInterfaceInstanceCount(modfind->second.second); if (intercount.first > 0) { LastModuleError = "Failed to unload module " + filename_str + ", being used by " + ConvToStr(intercount.first) + " other(s) via interface '" + intercount.second + "'"; - Instance->Log(DEFAULT, LastModuleError); + Instance->Logs->Log("MODULE", DEFAULT, LastModuleError); return false; } @@ -532,14 +532,14 @@ bool ModuleManager::Unload(const char* filename) delete modfind->second.first; Modules.erase(modfind); - Instance->Log(DEFAULT,"Module %s unloaded",filename); + Instance->Logs->Log("MODULE", DEFAULT,"Module %s unloaded",filename); this->ModCount--; Instance->BuildISupport(); return true; } LastModuleError = "Module " + filename_str + " is not loaded, cannot unload it!"; - Instance->Log(DEFAULT, LastModuleError); + Instance->Logs->Log("MODULE", DEFAULT, LastModuleError); return false; } @@ -556,7 +556,7 @@ void ModuleManager::LoadAll() if (!this->Load(configToken)) { - Instance->Log(DEFAULT, this->LastError()); + Instance->Logs->Log("MODULE", DEFAULT, this->LastError()); printf_c("\n[\033[1;31m*\033[0m] %s\n\n", this->LastError().c_str()); Instance->Exit(EXIT_STATUS_MODULE); } diff --git a/src/modules/extra/m_filter_pcre.cpp b/src/modules/extra/m_filter_pcre.cpp index b5c0c1762..f751a846d 100644 --- a/src/modules/extra/m_filter_pcre.cpp +++ b/src/modules/extra/m_filter_pcre.cpp @@ -121,8 +121,8 @@ class ModuleFilterPCRE : public FilterBase if (!re) { - ServerInstance->Log(DEFAULT,"Error in regular expression: %s at offset %d: %s\n", freeform.c_str(), erroffset, error); - ServerInstance->Log(DEFAULT,"Regular expression %s not loaded.", freeform.c_str()); + ServerInstance->Logs->Log("m_filter_pcre", DEFAULT,"Error in regular expression: %s at offset %d: %s\n", freeform.c_str(), erroffset, error); + ServerInstance->Logs->Log("m_filter_pcre", DEFAULT,"Regular expression %s not loaded.", freeform.c_str()); return std::make_pair(false, "Error in regular expression at offset " + ConvToStr(erroffset) + ": "+error); } else @@ -154,13 +154,13 @@ class ModuleFilterPCRE : public FilterBase if (!re) { - ServerInstance->Log(DEFAULT,"Error in regular expression: %s at offset %d: %s\n", pattern.c_str(), erroffset, error); - ServerInstance->Log(DEFAULT,"Regular expression %s not loaded.", pattern.c_str()); + ServerInstance->Logs->Log("CONFIG",DEFAULT,"Error in regular expression: %s at offset %d: %s\n", pattern.c_str(), erroffset, error); + ServerInstance->Logs->Log("CONFIG",DEFAULT,"Regular expression %s not loaded.", pattern.c_str()); } else { filters.push_back(PCREFilter(re, reason, action, gline_time, pattern, flgs)); - ServerInstance->Log(DEFAULT,"Regular expression %s loaded.", pattern.c_str()); + ServerInstance->Logs->Log("CONFIG",DEFAULT,"Regular expression %s loaded.", pattern.c_str()); } } FilterBase::OnRehash(user, parameter); diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp index 03dd99342..d79eb11ff 100644 --- a/src/modules/extra/m_mysql.cpp +++ b/src/modules/extra/m_mysql.cpp @@ -543,7 +543,7 @@ void ConnectDatabases(InspIRCd* ServerInstance) { /* XXX: MUTEX */ pthread_mutex_lock(&logging_mutex); - ServerInstance->Log(DEFAULT,"SQL: Failed to connect database "+i->second->GetHost()+": Error: "+i->second->GetError()); + ServerInstance->Logs->Log("m_mysql",DEFAULT,"SQL: Failed to connect database "+i->second->GetHost()+": Error: "+i->second->GetError()); i->second->SetEnable(false); pthread_mutex_unlock(&logging_mutex); } @@ -742,7 +742,7 @@ class ModuleSQL : public Module rc = pthread_join(Dispatcher, &status); if (rc) { - ServerInstance->Log(DEFAULT,"SQL: Error code from pthread_join() is " + rc); + ServerInstance->Logs->Log("m_mysql",DEFAULT,"SQL: Error code from pthread_join() is " + rc); } throw ModuleException("m_mysql: Unable to publish feature 'SQL'"); } @@ -760,7 +760,7 @@ class ModuleSQL : public Module rc = pthread_join(Dispatcher, &status); if (rc) { - ServerInstance->Log(DEFAULT,"SQL: Error code from pthread_join() is " + rc); + ServerInstance->Logs->Log("m_mysql",DEFAULT,"SQL: Error code from pthread_join() is " + rc); } ClearAllConnections(); delete Conf; diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp index a77e1ac90..72351cc93 100644 --- a/src/modules/extra/m_pgsql.cpp +++ b/src/modules/extra/m_pgsql.cpp @@ -111,7 +111,7 @@ class SQLresolver : public Resolver virtual void OnError(ResolverError e, const std::string &errormessage) { - ServerInstance->Log(DEBUG, "PgSQL: DNS lookup failed (%s), dying horribly", errormessage.c_str()); + ServerInstance->Logs->Log("m_pgsql",DEBUG, "PgSQL: DNS lookup failed (%s), dying horribly", errormessage.c_str()); } }; @@ -331,7 +331,7 @@ class SQLConn : public EventHandler idle = this->Instance->Time(); if(!DoConnect()) { - Instance->Log(DEFAULT, "WARNING: Could not connect to database with id: " + ConvToStr(hi.id)); + Instance->Logs->Log("m_pgsql",DEFAULT, "WARNING: Could not connect to database with id: " + ConvToStr(hi.id)); DelayReconnect(); } } @@ -383,7 +383,7 @@ class SQLConn : public EventHandler if (!this->Instance->SE->AddFd(this)) { - Instance->Log(DEBUG, "BUG: Couldn't add pgsql socket to socket engine"); + Instance->Logs->Log("m_pgsql",DEBUG, "BUG: Couldn't add pgsql socket to socket engine"); return false; } @@ -621,7 +621,7 @@ class SQLConn : public EventHandler #endif if(error) { - Instance->Log(DEBUG, "BUG: Apparently PQescapeStringConn() failed somehow...don't know how or what to do..."); + Instance->Logs->Log("m_pgsql",DEBUG, "BUG: Apparently PQescapeStringConn() failed somehow...don't know how or what to do..."); } /* Incremenet queryend to the end of the newly escaped parameter */ @@ -632,7 +632,7 @@ class SQLConn : public EventHandler } else { - Instance->Log(DEBUG, "BUG: Found a substitution location but no parameter to substitute :|"); + Instance->Logs->Log("m_pgsql",DEBUG, "BUG: Found a substitution location but no parameter to substitute :|"); break; } } @@ -698,7 +698,7 @@ class SQLConn : public EventHandler } else { - Instance->Log(DEBUG, "BUG: PQsocket cant be removed from socket engine!"); + Instance->Logs->Log("m_pgsql",DEBUG, "BUG: PQsocket cant be removed from socket engine!"); } } @@ -846,7 +846,7 @@ class ModulePgSQL : public Module else { /* Invalid address family, die horribly. */ - ServerInstance->Log(DEBUG, "BUG: insp_aton failed returning -1, oh noes."); + ServerInstance->Logs->Log("m_pgsql",DEBUG, "BUG: insp_aton failed returning -1, oh noes."); } } } @@ -880,7 +880,7 @@ class ModulePgSQL : public Module { if (HasHost(hi)) { - ServerInstance->Log(DEFAULT, "WARNING: A pgsql connection with id: %s already exists, possibly due to DNS delay. Aborting connection attempt.", hi.id.c_str()); + ServerInstance->Logs->Log("m_pgsql",DEFAULT, "WARNING: A pgsql connection with id: %s already exists, possibly due to DNS delay. Aborting connection attempt.", hi.id.c_str()); return; } diff --git a/src/modules/extra/m_rline.cpp b/src/modules/extra/m_rline.cpp index 189479efc..409e01ccd 100644 --- a/src/modules/extra/m_rline.cpp +++ b/src/modules/extra/m_rline.cpp @@ -62,7 +62,7 @@ class CoreExport RLine : public XLine { std::string compare = std::string(u->nick) + "!" + u->ident + "@" + u->host + " " + u->fullname; - ServerInstance->Log(DEBUG, "Matching " + matchtext + " against string " + compare); + ServerInstance->Logs->Log("m_rline",DEBUG, "Matching " + matchtext + " against string " + compare); if (pcre_exec(regex, NULL, compare.c_str(), compare.length(), 0, 0, NULL, 0) > -1) { diff --git a/src/modules/extra/m_sqlite3.cpp b/src/modules/extra/m_sqlite3.cpp index 1e62eb971..9a5c900f2 100644 --- a/src/modules/extra/m_sqlite3.cpp +++ b/src/modules/extra/m_sqlite3.cpp @@ -264,7 +264,7 @@ class SQLConn : public classbase { if (OpenDB() != SQLITE_OK) { - Instance->Log(DEFAULT, "WARNING: Could not open DB with id: " + host.id); + Instance->Logs->Log("m_sqlite3",DEFAULT, "WARNING: Could not open DB with id: " + host.id); CloseDB(); } } @@ -572,7 +572,7 @@ class ModuleSQLite3 : public Module { if (HasHost(hi)) { - ServerInstance->Log(DEFAULT, "WARNING: A sqlite connection with id: %s already exists. Aborting database open attempt.", hi.id.c_str()); + ServerInstance->Logs->Log("m_sqlite3",DEFAULT, "WARNING: A sqlite connection with id: %s already exists. Aborting database open attempt.", hi.id.c_str()); return; } diff --git a/src/modules/extra/m_sqloper.cpp b/src/modules/extra/m_sqloper.cpp index a1e28bafe..01ff0b3d4 100644 --- a/src/modules/extra/m_sqloper.cpp +++ b/src/modules/extra/m_sqloper.cpp @@ -128,7 +128,7 @@ public: } else { - ServerInstance->Log(SPARSE, "WARNING: Couldn't find SQL provider module. NOBODY will be able to oper up unless their o:line is statically configured"); + ServerInstance->Logs->Log("m_sqloper",SPARSE, "WARNING: Couldn't find SQL provider module. NOBODY will be able to oper up unless their o:line is statically configured"); return false; } } @@ -235,7 +235,7 @@ public: } else { - ServerInstance->Log(DEBUG, "BUG: WHAT?! Why do we have no OPER command?!"); + ServerInstance->Logs->Log("m_sqloper",DEBUG, "BUG: WHAT?! Why do we have no OPER command?!"); } } diff --git a/src/modules/extra/m_sqlutils.cpp b/src/modules/extra/m_sqlutils.cpp index 30fcf968e..5935e1553 100644 --- a/src/modules/extra/m_sqlutils.cpp +++ b/src/modules/extra/m_sqlutils.cpp @@ -123,14 +123,14 @@ public: { if(iter->second != user) { - ServerInstance->Log(DEBUG, "BUG: ID associated with user %s doesn't have the same User* associated with it in the map (erasing anyway)", user->nick); + ServerInstance->Logs->Log("m_sqlutils",DEBUG, "BUG: ID associated with user %s doesn't have the same User* associated with it in the map (erasing anyway)", user->nick); } iduser.erase(iter); } else { - ServerInstance->Log(DEBUG, "BUG: user %s was extended with sqlutils_queryids but there was nothing matching in the map", user->nick); + ServerInstance->Logs->Log("m_sqlutils",DEBUG, "BUG: user %s was extended with sqlutils_queryids but there was nothing matching in the map", user->nick); } } @@ -210,13 +210,13 @@ public: { if(iter->second != chan) { - ServerInstance->Log(DEBUG, "BUG: ID associated with channel %s doesn't have the same Channel* associated with it in the map (erasing anyway)", chan->name); + ServerInstance->Logs->Log("m_sqlutils",DEBUG, "BUG: ID associated with channel %s doesn't have the same Channel* associated with it in the map (erasing anyway)", chan->name); } idchan.erase(iter); } else { - ServerInstance->Log(DEBUG, "BUG: channel %s was extended with sqlutils_queryids but there was nothing matching in the map", chan->name); + ServerInstance->Logs->Log("m_sqlutils",DEBUG, "BUG: channel %s was extended with sqlutils_queryids but there was nothing matching in the map", chan->name); } } diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index e1f4b8451..f79ef47fa 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -99,11 +99,11 @@ class ModuleSSLGnuTLS : public Module gnutls_global_init(); // This must be called once in the program if(gnutls_certificate_allocate_credentials(&x509_cred) != 0) - ServerInstance->Log(DEFAULT, "m_ssl_gnutls.so: Failed to allocate certificate credentials"); + ServerInstance->Logs->Log("m_ssl_gnutls",DEFAULT, "m_ssl_gnutls.so: Failed to allocate certificate credentials"); // Guessing return meaning if(gnutls_dh_params_init(&dh_params) < 0) - ServerInstance->Log(DEFAULT, "m_ssl_gnutls.so: Failed to initialise DH parameters"); + ServerInstance->Logs->Log("m_ssl_gnutls",DEFAULT, "m_ssl_gnutls.so: Failed to initialise DH parameters"); // Needs the flag as it ignores a plain /rehash OnRehash(NULL,"ssl"); @@ -149,17 +149,17 @@ class ModuleSSLGnuTLS : public Module for (size_t i = 0; i < ServerInstance->Config->ports.size(); i++) if (ServerInstance->Config->ports[i]->GetPort() == portno) ServerInstance->Config->ports[i]->SetDescription("ssl"); - ServerInstance->Log(DEFAULT, "m_ssl_gnutls.so: Enabling SSL for port %d", portno); + ServerInstance->Logs->Log("m_ssl_gnutls",DEFAULT, "m_ssl_gnutls.so: Enabling SSL for port %d", portno); sslports.append("*:").append(ConvToStr(portno)).append(";"); } else { - ServerInstance->Log(DEFAULT, "m_ssl_gnutls.so: FAILED to enable SSL on port %d, maybe you have another ssl or similar module loaded?", portno); + ServerInstance->Logs->Log("m_ssl_gnutls",DEFAULT, "m_ssl_gnutls.so: FAILED to enable SSL on port %d, maybe you have another ssl or similar module loaded?", portno); } } catch (ModuleException &e) { - ServerInstance->Log(DEFAULT, "m_ssl_gnutls.so: FAILED to enable SSL on port %d: %s. Maybe it's already hooked by the same port on a different IP, or you have an other SSL or similar module loaded?", portno, e.GetReason()); + ServerInstance->Logs->Log("m_ssl_gnutls",DEFAULT, "m_ssl_gnutls.so: FAILED to enable SSL on port %d: %s. Maybe it's already hooked by the same port on a different IP, or you have an other SSL or similar module loaded?", portno, e.GetReason()); } } } @@ -213,10 +213,10 @@ class ModuleSSLGnuTLS : public Module int ret; if((ret =gnutls_certificate_set_x509_trust_file(x509_cred, cafile.c_str(), GNUTLS_X509_FMT_PEM)) < 0) - ServerInstance->Log(DEFAULT, "m_ssl_gnutls.so: Failed to set X.509 trust file '%s': %s", cafile.c_str(), gnutls_strerror(ret)); + ServerInstance->Logs->Log("m_ssl_gnutls",DEFAULT, "m_ssl_gnutls.so: Failed to set X.509 trust file '%s': %s", cafile.c_str(), gnutls_strerror(ret)); if((ret = gnutls_certificate_set_x509_crl_file (x509_cred, crlfile.c_str(), GNUTLS_X509_FMT_PEM)) < 0) - ServerInstance->Log(DEFAULT, "m_ssl_gnutls.so: Failed to set X.509 CRL file '%s': %s", crlfile.c_str(), gnutls_strerror(ret)); + ServerInstance->Logs->Log("m_ssl_gnutls",DEFAULT, "m_ssl_gnutls.so: Failed to set X.509 CRL file '%s': %s", crlfile.c_str(), gnutls_strerror(ret)); if((ret = gnutls_certificate_set_x509_key_file (x509_cred, certfile.c_str(), keyfile.c_str(), GNUTLS_X509_FMT_PEM)) < 0) { @@ -240,7 +240,7 @@ class ModuleSSLGnuTLS : public Module int ret; if((ret = gnutls_dh_params_generate2(dh_params, dh_bits)) < 0) - ServerInstance->Log(DEFAULT, "m_ssl_gnutls.so: Failed to generate DH parameters (%d bits): %s", dh_bits, gnutls_strerror(ret)); + ServerInstance->Logs->Log("m_ssl_gnutls",DEFAULT, "m_ssl_gnutls.so: Failed to generate DH parameters (%d bits): %s", dh_bits, gnutls_strerror(ret)); } virtual ~ModuleSSLGnuTLS() diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index 667b2a5cd..2af851f05 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -188,17 +188,17 @@ class ModuleSSLOpenSSL : public Module for (size_t i = 0; i < ServerInstance->Config->ports.size(); i++) if (ServerInstance->Config->ports[i]->GetPort() == portno) ServerInstance->Config->ports[i]->SetDescription("ssl"); - ServerInstance->Log(DEFAULT, "m_ssl_openssl.so: Enabling SSL for port %d", portno); + ServerInstance->Logs->Log("m_ssl_openssl",DEFAULT, "m_ssl_openssl.so: Enabling SSL for port %d", portno); sslports.append("*:").append(ConvToStr(portno)).append(";"); } else { - ServerInstance->Log(DEFAULT, "m_ssl_openssl.so: FAILED to enable SSL on port %d, maybe you have another ssl or similar module loaded?", portno); + ServerInstance->Logs->Log("m_ssl_openssl",DEFAULT, "m_ssl_openssl.so: FAILED to enable SSL on port %d, maybe you have another ssl or similar module loaded?", portno); } } catch (ModuleException &e) { - ServerInstance->Log(DEFAULT, "m_ssl_openssl.so: FAILED to enable SSL on port %d: %s. Maybe it's already hooked by the same port on a different IP, or you have another SSL or similar module loaded?", portno, e.GetReason()); + ServerInstance->Logs->Log("m_ssl_openssl",DEFAULT, "m_ssl_openssl.so: FAILED to enable SSL on port %d: %s. Maybe it's already hooked by the same port on a different IP, or you have another SSL or similar module loaded?", portno, e.GetReason()); } } } @@ -252,20 +252,20 @@ class ModuleSSLOpenSSL : public Module */ if ((!SSL_CTX_use_certificate_chain_file(ctx, certfile.c_str())) || (!SSL_CTX_use_certificate_chain_file(clictx, certfile.c_str()))) { - ServerInstance->Log(DEFAULT, "m_ssl_openssl.so: Can't read certificate file %s. %s", certfile.c_str(), strerror(errno)); + ServerInstance->Logs->Log("m_ssl_openssl",DEFAULT, "m_ssl_openssl.so: Can't read certificate file %s. %s", certfile.c_str(), strerror(errno)); ERR_print_errors_cb(error_callback, this); } if (((!SSL_CTX_use_PrivateKey_file(ctx, keyfile.c_str(), SSL_FILETYPE_PEM))) || (!SSL_CTX_use_PrivateKey_file(clictx, keyfile.c_str(), SSL_FILETYPE_PEM))) { - ServerInstance->Log(DEFAULT, "m_ssl_openssl.so: Can't read key file %s. %s", keyfile.c_str(), strerror(errno)); + ServerInstance->Logs->Log("m_ssl_openssl",DEFAULT, "m_ssl_openssl.so: Can't read key file %s. %s", keyfile.c_str(), strerror(errno)); ERR_print_errors_cb(error_callback, this); } /* Load the CAs we trust*/ if (((!SSL_CTX_load_verify_locations(ctx, cafile.c_str(), 0))) || (!SSL_CTX_load_verify_locations(clictx, cafile.c_str(), 0))) { - ServerInstance->Log(DEFAULT, "m_ssl_openssl.so: Can't read CA list from %s. %s", cafile.c_str(), strerror(errno)); + ServerInstance->Logs->Log("m_ssl_openssl",DEFAULT, "m_ssl_openssl.so: Can't read CA list from %s. %s", cafile.c_str(), strerror(errno)); ERR_print_errors_cb(error_callback, this); } @@ -274,7 +274,7 @@ class ModuleSSLOpenSSL : public Module if (dhpfile == NULL) { - ServerInstance->Log(DEFAULT, "m_ssl_openssl.so Couldn't open DH file %s: %s", dhfile.c_str(), strerror(errno)); + ServerInstance->Logs->Log("m_ssl_openssl",DEFAULT, "m_ssl_openssl.so Couldn't open DH file %s: %s", dhfile.c_str(), strerror(errno)); throw ModuleException("Couldn't open DH file " + dhfile + ": " + strerror(errno)); } else @@ -282,7 +282,7 @@ class ModuleSSLOpenSSL : public Module ret = PEM_read_DHparams(dhpfile, NULL, NULL, NULL); if ((SSL_CTX_set_tmp_dh(ctx, ret) < 0) || (SSL_CTX_set_tmp_dh(clictx, ret) < 0)) { - ServerInstance->Log(DEFAULT, "m_ssl_openssl.so: Couldn't set DH parameters %s. SSL errors follow:", dhfile.c_str()); + ServerInstance->Logs->Log("m_ssl_openssl",DEFAULT, "m_ssl_openssl.so: Couldn't set DH parameters %s. SSL errors follow:", dhfile.c_str()); ERR_print_errors_cb(error_callback, this); } } @@ -409,7 +409,7 @@ class ModuleSSLOpenSSL : public Module if (SSL_set_fd(session->sess, fd) == 0) { - ServerInstance->Log(DEBUG,"BUG: Can't set fd with SSL_set_fd: %d", fd); + ServerInstance->Logs->Log("m_ssl_openssl",DEBUG,"BUG: Can't set fd with SSL_set_fd: %d", fd); return; } @@ -436,7 +436,7 @@ class ModuleSSLOpenSSL : public Module if (SSL_set_fd(session->sess, fd) == 0) { - ServerInstance->Log(DEBUG,"BUG: Can't set fd with SSL_set_fd: %d", fd); + ServerInstance->Logs->Log("m_ssl_openssl",DEBUG,"BUG: Can't set fd with SSL_set_fd: %d", fd); return; } @@ -886,7 +886,7 @@ class ModuleSSLOpenSSL : public Module static int error_callback(const char *str, size_t len, void *u) { ModuleSSLOpenSSL* mssl = (ModuleSSLOpenSSL*)u; - mssl->PublicInstance->Log(DEFAULT, "SSL error: " + std::string(str, len - 1)); + mssl->PublicInstance->Logs->Log("m_ssl_openssl",DEFAULT, "SSL error: " + std::string(str, len - 1)); return 0; } diff --git a/src/modules/extra/m_ssl_oper_cert.cpp b/src/modules/extra/m_ssl_oper_cert.cpp index 312ec874b..abf8c5d4a 100644 --- a/src/modules/extra/m_ssl_oper_cert.cpp +++ b/src/modules/extra/m_ssl_oper_cert.cpp @@ -159,7 +159,7 @@ class ModuleOperSSLCert : public Module { user->WriteServ("491 %s :This oper login name requires a matching key fingerprint.",user->nick); ServerInstance->SNO->WriteToSnoMask('o',"'%s' cannot oper, does not match fingerprint", user->nick); - ServerInstance->Log(DEFAULT,"OPER: Failed oper attempt by %s!%s@%s: credentials valid, but wrong fingerprint.",user->nick,user->ident,user->host); + ServerInstance->Logs->Log("m_ssl_oper_cert",DEFAULT,"OPER: Failed oper attempt by %s!%s@%s: credentials valid, but wrong fingerprint.",user->nick,user->ident,user->host); return 1; } } diff --git a/src/modules/m_blockcaps.cpp b/src/modules/m_blockcaps.cpp index cfad61f17..bcbc82cac 100644 --- a/src/modules/m_blockcaps.cpp +++ b/src/modules/m_blockcaps.cpp @@ -115,12 +115,12 @@ public: capsmap[(unsigned char)*n] = 1; if (percent < 1 || percent > 100) { - ServerInstance->Log(DEFAULT, "<blockcaps:percent> out of range, setting to default of 100."); + ServerInstance->Logs->Log("CONFIG",DEFAULT, "<blockcaps:percent> out of range, setting to default of 100."); percent = 100; } if (minlen < 1 || minlen > MAXBUF-1) { - ServerInstance->Log(DEFAULT, "<blockcaps:minlen> out of range, setting to default of 1."); + ServerInstance->Logs->Log("CONFIG",DEFAULT, "<blockcaps:minlen> out of range, setting to default of 1."); minlen = 1; } } diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp index 633e95af9..3f7e27418 100644 --- a/src/modules/m_cgiirc.cpp +++ b/src/modules/m_cgiirc.cpp @@ -172,7 +172,7 @@ public: if(hostmask.length()) { if (type == "webirc" && !password.length()) { - ServerInstance->Log(DEFAULT, "m_cgiirc: Missing password in config: %s", hostmask.c_str()); + ServerInstance->Logs->Log("CONFIG",DEFAULT, "m_cgiirc: Missing password in config: %s", hostmask.c_str()); } else { @@ -196,7 +196,7 @@ public: } else { - ServerInstance->Log(DEFAULT, "m_cgiirc.so: Invalid <cgihost:mask> value in config: %s", hostmask.c_str()); + ServerInstance->Logs->Log("CONFIG",DEFAULT, "m_cgiirc.so: Invalid <cgihost:mask> value in config: %s", hostmask.c_str()); continue; } } diff --git a/src/modules/m_filter.h b/src/modules/m_filter.h index 1be1f85ff..e1f97bd72 100644 --- a/src/modules/m_filter.h +++ b/src/modules/m_filter.h @@ -289,7 +289,7 @@ int FilterBase::OnUserPreNotice(User* user,void* dest,int target_type, std::stri delete gl; } - ServerInstance->Log(DEFAULT,"FILTER: "+std::string(user->nick)+std::string(" had their message filtered, target was ")+target+": "+f->reason+" Action: "+f->action); + ServerInstance->Logs->Log("FILTER",DEFAULT,"FILTER: "+std::string(user->nick)+std::string(" had their message filtered, target was ")+target+": "+f->reason+" Action: "+f->action); return 1; } return 0; diff --git a/src/modules/m_foobar.cpp b/src/modules/m_foobar.cpp index 612b9d62b..bffdd7730 100644 --- a/src/modules/m_foobar.cpp +++ b/src/modules/m_foobar.cpp @@ -57,7 +57,7 @@ class ModuleFoobar : public Module // method called when a user connects std::string b = user->nick; - ServerInstance->Log(DEBUG,"Foobar: User connecting: "+b); + ServerInstance->Logs->Log("m_foobar",DEBUG,"Foobar: User connecting: "+b); } virtual void OnUserQuit(User* user, const std::string &reason, const std::string &oper_message) @@ -65,7 +65,7 @@ class ModuleFoobar : public Module // method called when a user disconnects std::string b = user->nick; - ServerInstance->Log(DEBUG,"Foobar: User quitting: "+b); + ServerInstance->Logs->Log("m_foobar",DEBUG,"Foobar: User quitting: "+b); } virtual void OnUserJoin(User* user, Channel* channel, bool sync, bool &silent) @@ -74,7 +74,7 @@ class ModuleFoobar : public Module std::string c = channel->name; std::string b = user->nick; - ServerInstance->Log(DEBUG,"Foobar: User "+b+" joined "+c); + ServerInstance->Logs->Log("m_foobar",DEBUG,"Foobar: User "+b+" joined "+c); } virtual void OnUserPart(User* user, Channel* channel, const std::string &partreason, bool &silent) @@ -83,7 +83,7 @@ class ModuleFoobar : public Module std::string c = channel->name; std::string b = user->nick; - ServerInstance->Log(DEBUG,"Foobar: User "+b+" parted "+c); + ServerInstance->Logs->Log("m_foobar",DEBUG,"Foobar: User "+b+" parted "+c); } }; diff --git a/src/modules/m_http_client.cpp b/src/modules/m_http_client.cpp index 4cb7b2848..9cf6e45b4 100644 --- a/src/modules/m_http_client.cpp +++ b/src/modules/m_http_client.cpp @@ -56,13 +56,13 @@ class HTTPResolver : public Resolver public: HTTPResolver(HTTPSocket *s, InspIRCd *Instance, const std::string &hostname, bool &cached, Module* me) : Resolver(Instance, hostname, DNS_QUERY_FORWARD, cached, me), socket(s) { - ServerInstance->Log(DEBUG,">>>>>>>>>>>>>>>>>> HTTPResolver::HTTPResolver <<<<<<<<<<<<<<<"); + ServerInstance->Logs->Log("m_http_client",DEBUG,">>>>>>>>>>>>>>>>>> HTTPResolver::HTTPResolver <<<<<<<<<<<<<<<"); orig = hostname; } void OnLookupComplete(const std::string &result, unsigned int ttl, bool cached, int resultnum = 0) { - ServerInstance->Log(DEBUG,"************* HTTPResolver::OnLookupComplete ***************"); + ServerInstance->Logs->Log("m_http_client",DEBUG,"************* HTTPResolver::OnLookupComplete ***************"); if (!resultnum) socket->Connect(result); else @@ -71,7 +71,7 @@ class HTTPResolver : public Resolver void OnError(ResolverError e, const std::string &errmsg) { - ServerInstance->Log(DEBUG,"!!!!!!!!!!!!!!!! HTTPResolver::OnError: %s", errmsg.c_str()); + ServerInstance->Logs->Log("m_http_client",DEBUG,"!!!!!!!!!!!!!!!! HTTPResolver::OnError: %s", errmsg.c_str()); socket->OnClose(); } }; @@ -119,7 +119,7 @@ class ModuleHTTPClient : public Module HTTPSocket::HTTPSocket(InspIRCd *SI, ModuleHTTPClient *m) : BufferedSocket(SI), Server(SI), Mod(m), status(HTTP_CLOSED) { - Instance->Log(DEBUG,"HTTPSocket::HTTPSocket"); + Instance->Logs->Log("m_http_client",DEBUG,"HTTPSocket::HTTPSocket"); this->port = 80; response = NULL; closed = false; @@ -141,7 +141,7 @@ HTTPSocket::~HTTPSocket() bool HTTPSocket::DoRequest(HTTPClientRequest *request) { - Instance->Log(DEBUG,"HTTPSocket::DoRequest"); + Instance->Logs->Log("m_http_client",DEBUG,"HTTPSocket::DoRequest"); /* Tweak by brain - we take a copy of this, * so that the caller doesnt need to leave * pointers knocking around, less chance of @@ -155,7 +155,7 @@ bool HTTPSocket::DoRequest(HTTPClientRequest *request) this->port = url.port; strlcpy(this->host, url.domain.c_str(), MAXBUF); - Instance->Log(DEBUG,"Doing request for %s", url.url.c_str()); + Instance->Logs->Log("m_http_client",DEBUG,"Doing request for %s", url.url.c_str()); in6_addr s6; in_addr s4; @@ -165,7 +165,7 @@ bool HTTPSocket::DoRequest(HTTPClientRequest *request) bool cached; HTTPResolver* r = new HTTPResolver(this, Server, url.domain, cached, (Module*)Mod); Instance->AddResolver(r, cached); - Instance->Log(DEBUG,"Resolver added, cached=%d", cached); + Instance->Logs->Log("m_http_client",DEBUG,"Resolver added, cached=%d", cached); } else Connect(url.domain); @@ -175,7 +175,7 @@ bool HTTPSocket::DoRequest(HTTPClientRequest *request) bool HTTPSocket::ParseURL(const std::string &iurl) { - Instance->Log(DEBUG,"HTTPSocket::ParseURL %s", iurl.c_str()); + Instance->Logs->Log("m_http_client",DEBUG,"HTTPSocket::ParseURL %s", iurl.c_str()); url.url = iurl; url.port = 80; url.protocol = "http"; @@ -243,13 +243,13 @@ bool HTTPSocket::ParseURL(const std::string &iurl) if ((url.domain.empty()) || (!url.port) || (url.protocol.empty())) { - Instance->Log(DEFAULT, "Invalid URL (%s): Missing required value", iurl.c_str()); + Instance->Logs->Log("m_http_client",DEFAULT, "Invalid URL (%s): Missing required value", iurl.c_str()); return false; } if (url.protocol != "http") { - Instance->Log(DEFAULT, "Invalid URL (%s): Unsupported protocol '%s'", iurl.c_str(), url.protocol.c_str()); + Instance->Logs->Log("m_http_client",DEFAULT, "Invalid URL (%s): Unsupported protocol '%s'", iurl.c_str(), url.protocol.c_str()); return false; } @@ -260,20 +260,20 @@ void HTTPSocket::Connect(const std::string &ip) { this->response = new HTTPClientResponse((Module*)Mod, req.GetSource() , url.url, 0, ""); - Instance->Log(DEBUG,"HTTPSocket::Connect(%s) response=%08lx", ip.c_str(), response); + Instance->Logs->Log("m_http_client",DEBUG,"HTTPSocket::Connect(%s) response=%08lx", ip.c_str(), response); strlcpy(this->IP, ip.c_str(), MAXBUF); strlcpy(this->host, ip.c_str(), MAXBUF); if (!this->DoConnect()) { - Instance->Log(DEBUG,"DoConnect failed, bailing"); + Instance->Logs->Log("m_http_client",DEBUG,"DoConnect failed, bailing"); this->Close(); } } bool HTTPSocket::OnConnected() { - Instance->Log(DEBUG,"HTTPSocket::OnConnected"); + Instance->Logs->Log("m_http_client",DEBUG,"HTTPSocket::OnConnected"); std::string request = "GET " + url.request + " HTTP/1.1\r\n"; @@ -297,7 +297,7 @@ bool HTTPSocket::OnConnected() bool HTTPSocket::OnDataReady() { - Instance->Log(DEBUG,"HTTPSocket::OnDataReady() for %s", url.url.c_str()); + Instance->Logs->Log("m_http_client",DEBUG,"HTTPSocket::OnDataReady() for %s", url.url.c_str()); const char *sdata = this->Read(); if (!sdata) @@ -354,18 +354,18 @@ void HTTPSocket::OnClose() if (!closed) { closed = true; - Instance->Log(DEBUG,"HTTPSocket::OnClose response=%08lx", response); + Instance->Logs->Log("m_http_client",DEBUG,"HTTPSocket::OnClose response=%08lx", response); std::string e; if (data.empty()) { - Instance->Log(DEBUG,"Send error"); + Instance->Logs->Log("m_http_client",DEBUG,"Send error"); HTTPClientError* err = new HTTPClientError((Module*)Mod, req.GetSource(), req.GetURL(), 0); err->Send(); delete err; return; } - Instance->Log(DEBUG,"Set data and send, %s", response->GetURL().c_str()); + Instance->Logs->Log("m_http_client",DEBUG,"Set data and send, %s", response->GetURL().c_str()); response->SetData(data); response->Send(); delete response; diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp index 56a24119f..3bf99bfdf 100644 --- a/src/modules/m_httpd.cpp +++ b/src/modules/m_httpd.cpp @@ -290,7 +290,7 @@ class HttpServerSocket : public BufferedSocket if (reqbuffer.length() >= 8192) { - Instance->Log(DEBUG, "m_httpd dropped connection due to an oversized request buffer"); + Instance->Logs->Log("m_httpd",DEBUG, "m_httpd dropped connection due to an oversized request buffer"); reqbuffer.clear(); return false; } diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp index 185b9cf6d..fd9fd4434 100644 --- a/src/modules/m_ident.cpp +++ b/src/modules/m_ident.cpp @@ -180,7 +180,7 @@ class IdentRequestSocket : public EventHandler virtual void OnConnected() { - ServerInstance->Log(DEBUG,"OnConnected()"); + ServerInstance->Logs->Log("m_ident",DEBUG,"OnConnected()"); /* Both sockaddr_in and sockaddr_in6 can be safely casted to sockaddr, especially since the * only members we use are in a part of the struct that should always be identical (at the @@ -230,7 +230,7 @@ class IdentRequestSocket : public EventHandler break; case EVENT_ERROR: /* fd error event, ohshi- */ - ServerInstance->Log(DEBUG,"EVENT_ERROR"); + ServerInstance->Logs->Log("m_ident",DEBUG,"EVENT_ERROR"); /* We *must* Close() here immediately or we get a * huge storm of EVENT_ERROR events! */ @@ -247,7 +247,7 @@ class IdentRequestSocket : public EventHandler */ if (GetFd() > -1) { - ServerInstance->Log(DEBUG,"Close ident socket %d", GetFd()); + ServerInstance->Logs->Log("m_ident",DEBUG,"Close ident socket %d", GetFd()); ServerInstance->SE->DelFd(this); ServerInstance->SE->Close(GetFd()); ServerInstance->SE->Shutdown(GetFd(), SHUT_WR); @@ -286,7 +286,7 @@ class IdentRequestSocket : public EventHandler return; } - ServerInstance->Log(DEBUG,"ReadResponse()"); + ServerInstance->Logs->Log("m_ident",DEBUG,"ReadResponse()"); irc::sepstream sep(ibuf, ':'); std::string token; @@ -402,7 +402,7 @@ class ModuleIdent : public Module } catch (ModuleException &e) { - ServerInstance->Log(DEBUG,"Ident exception: %s", e.GetReason()); + ServerInstance->Logs->Log("m_ident",DEBUG,"Ident exception: %s", e.GetReason()); return 0; } @@ -416,17 +416,17 @@ class ModuleIdent : public Module */ virtual bool OnCheckReady(User *user) { - ServerInstance->Log(DEBUG,"OnCheckReady %s", user->nick); + ServerInstance->Logs->Log("m_ident",DEBUG,"OnCheckReady %s", user->nick); /* Does user have an ident socket attached at all? */ IdentRequestSocket *isock = NULL; if (!user->GetExt("ident_socket", isock)) { - ServerInstance->Log(DEBUG, "No ident socket :("); + ServerInstance->Logs->Log("m_ident",DEBUG, "No ident socket :("); return true; } - ServerInstance->Log(DEBUG, "Has ident_socket"); + ServerInstance->Logs->Log("m_ident",DEBUG, "Has ident_socket"); time_t compare = isock->age; compare += RequestTimeout; @@ -436,7 +436,7 @@ class ModuleIdent : public Module { /* Ident timeout */ user->WriteServ("NOTICE Auth :*** Ident request timed out."); - ServerInstance->Log(DEBUG, "Timeout"); + ServerInstance->Logs->Log("m_ident",DEBUG, "Timeout"); /* The user isnt actually disconnecting, * we call this to clean up the user */ @@ -447,11 +447,11 @@ class ModuleIdent : public Module /* Got a result yet? */ if (!isock->HasResult()) { - ServerInstance->Log(DEBUG, "No result yet"); + ServerInstance->Logs->Log("m_ident",DEBUG, "No result yet"); return false; } - ServerInstance->Log(DEBUG, "Yay, result!"); + ServerInstance->Logs->Log("m_ident",DEBUG, "Yay, result!"); /* wooo, got a result (it will be good, or bad) */ if (*(isock->GetResult()) != '~') @@ -483,7 +483,7 @@ class ModuleIdent : public Module isock->Close(); delete isock; user->Shrink("ident_socket"); - ServerInstance->Log(DEBUG, "Removed ident socket from %s", user->nick); + ServerInstance->Logs->Log("m_ident",DEBUG, "Removed ident socket from %s", user->nick); } } }; diff --git a/src/modules/m_operlog.cpp b/src/modules/m_operlog.cpp index eac5a9407..a9ce4aa9b 100644 --- a/src/modules/m_operlog.cpp +++ b/src/modules/m_operlog.cpp @@ -52,7 +52,7 @@ class ModuleOperLog : public Module for (int j = 0; j < pcnt; j++) plist.append(std::string(" ")+std::string(parameters[j])); - ServerInstance->Log(DEFAULT,"OPERLOG: [%s!%s@%s] %s%s",user->nick,user->ident,user->host,command.c_str(),plist.c_str()); + ServerInstance->Logs->Log("m_operlog",DEFAULT,"OPERLOG: [%s!%s@%s] %s%s",user->nick,user->ident,user->host,command.c_str(),plist.c_str()); } } diff --git a/src/modules/m_password_hash.cpp b/src/modules/m_password_hash.cpp index 0db1147dd..bd039865a 100644 --- a/src/modules/m_password_hash.cpp +++ b/src/modules/m_password_hash.cpp @@ -120,7 +120,7 @@ class ModuleOperHash : public Module { if (ServerInstance->Modules->ModuleHasInterface(mod, "HashRequest")) { - ServerInstance->Log(DEBUG, "Post-load registering hasher: %s", name.c_str()); + ServerInstance->Logs->Log("m_password-hash",DEBUG, "Post-load registering hasher: %s", name.c_str()); std::string sname = HashNameRequest(this, mod).Send(); hashers[sname.c_str()] = mod; names.push_back(sname); diff --git a/src/modules/m_proxyscan.cpp b/src/modules/m_proxyscan.cpp index f65382ac1..6b2c489f8 100644 --- a/src/modules/m_proxyscan.cpp +++ b/src/modules/m_proxyscan.cpp @@ -189,7 +189,7 @@ class ProxySocket : public EventHandler virtual void OnConnected() { - ServerInstance->Log(DEBUG,"OnConnected()"); + ServerInstance->Logs->Log("m_proxyscan",DEBUG,"OnConnected()"); /* Both sockaddr_in and sockaddr_in6 can be safely casted to sockaddr, especially since the * only members we use are in a part of the struct that should always be identical (at the @@ -212,10 +212,10 @@ class ProxySocket : public EventHandler /* Send failed if we didnt write the whole ident request -- * might as well give up if this happens! */ - ServerInstance->Log(DEBUG, "Sending"); + ServerInstance->Logs->Log("m_proxyscan",DEBUG, "Sending"); if (ServerInstance->SE->Send(this, this->challenge, this->clen, 0) < this->clen) { - ServerInstance->Log(DEBUG, "Send incomplete"); + ServerInstance->Logs->Log("m_proxyscan",DEBUG, "Send incomplete"); done = true; } } @@ -234,7 +234,7 @@ class ProxySocket : public EventHandler break; case EVENT_ERROR: /* fd error event, ohshi- */ - ServerInstance->Log(DEBUG,"EVENT_ERROR"); + ServerInstance->Logs->Log("m_proxyscan",DEBUG,"EVENT_ERROR"); /* We *must* Close() here immediately or we get a * huge storm of EVENT_ERROR events! */ @@ -251,7 +251,7 @@ class ProxySocket : public EventHandler */ if (GetFd() > -1) { - ServerInstance->Log(DEBUG,"Close ident socket %d", GetFd()); + ServerInstance->Logs->Log("m_proxyscan",DEBUG,"Close ident socket %d", GetFd()); ServerInstance->SE->DelFd(this); ServerInstance->SE->Close(GetFd()); ServerInstance->SE->Shutdown(GetFd(), SHUT_WR); @@ -272,7 +272,7 @@ class ProxySocket : public EventHandler char ibuf[MAXBUF]; int recvresult = ServerInstance->SE->Recv(this, ibuf, MAXBUF-1, 0); - ServerInstance->Log(DEBUG,"ReadResponse(): %s -- %d", ibuf, recvresult); + ServerInstance->Logs->Log("m_proxyscan",DEBUG,"ReadResponse(): %s -- %d", ibuf, recvresult); bool match = true; int i; @@ -281,7 +281,7 @@ class ProxySocket : public EventHandler { if (this->response[i] != ibuf[i]) { - ServerInstance->Log(DEBUG, "No match at pos %d: %c ne %c", i, this->response[i], ibuf[i]); + ServerInstance->Logs->Log("m_proxyscan",DEBUG, "No match at pos %d: %c ne %c", i, this->response[i], ibuf[i]); /* no match */ match = false; } @@ -360,7 +360,7 @@ class ModuleProxy : public Module } catch (ModuleException &e) { - ServerInstance->Log(DEBUG,"Proxy exception: %s", e.GetReason()); + ServerInstance->Logs->Log("m_proxyscan",DEBUG,"Proxy exception: %s", e.GetReason()); return 0; } @@ -384,7 +384,7 @@ class ModuleProxy : public Module p->Close(); delete p; user->Shrink("proxy_socket"); - ServerInstance->Log(DEBUG, "Removed proxy socket from %s", user->nick); + ServerInstance->Logs->Log("m_proxyscan",DEBUG, "Removed proxy socket from %s", user->nick); } } }; diff --git a/src/modules/m_quitban.cpp b/src/modules/m_quitban.cpp index 2509a17b7..6da23b735 100644 --- a/src/modules/m_quitban.cpp +++ b/src/modules/m_quitban.cpp @@ -64,7 +64,7 @@ class ModuleChanCreate : public Module if (i != quits.end()) { i->second++; - ServerInstance->Log(DEBUG, "quitban: Count for IP is now %d", i->second); + ServerInstance->Logs->Log("m_quitban",DEBUG, "quitban: Count for IP is now %d", i->second); if (i->second >= threshold) { @@ -82,13 +82,13 @@ class ModuleChanCreate : public Module else { quits[u->GetIPString()] = 1; - ServerInstance->Log(DEBUG, "quitban: Added new record"); + ServerInstance->Logs->Log("m_quitban",DEBUG, "quitban: Added new record"); } } virtual void OnGarbageCollect() { - ServerInstance->Log(DEBUG, "quitban: Clearing map."); + ServerInstance->Logs->Log("m_quitban",DEBUG, "quitban: Clearing map."); quits.clear(); } }; diff --git a/src/modules/m_remoteinclude_http.cpp b/src/modules/m_remoteinclude_http.cpp index d55b4a251..a0dc6cb0e 100644 --- a/src/modules/m_remoteinclude_http.cpp +++ b/src/modules/m_remoteinclude_http.cpp @@ -41,7 +41,7 @@ class ModuleRemoteIncludeHttp : public Module return 0; #else std::stringstream* gotfile = (std::stringstream*)filedata; - ServerInstance->Log(DEBUG,"OnDownloadFile in m_remoteinclude_http"); + ServerInstance->Logs->Log("m_remoteinclude_http",DEBUG,"OnDownloadFile in m_remoteinclude_http"); int sockfd, portno, n; struct sockaddr_in serv_addr; struct hostent *server; @@ -57,13 +57,13 @@ class ModuleRemoteIncludeHttp : public Module sockfd = socket(AF_INET, SOCK_STREAM, 0); if (sockfd < 0) { - ServerInstance->Log(DEBUG,"Failed to socket()"); + ServerInstance->Logs->Log("m_remoteinclude_http",DEBUG,"Failed to socket()"); return 0; } if (server == NULL) { - ServerInstance->Log(DEBUG,"No such host"); + ServerInstance->Logs->Log("m_remoteinclude_http",DEBUG,"No such host"); return 0; } @@ -76,20 +76,20 @@ class ModuleRemoteIncludeHttp : public Module if (connect(sockfd, (const sockaddr*)&serv_addr, sizeof(serv_addr)) < 0) { - ServerInstance->Log(DEBUG,"Failed to connect()"); + ServerInstance->Logs->Log("m_remoteinclude_http",DEBUG,"Failed to connect()"); return 0; } - ServerInstance->Log(DEBUG,"Connected to brainbox"); + ServerInstance->Logs->Log("m_remoteinclude_http",DEBUG,"Connected to brainbox"); n = this->SockSend(sockfd, "GET / HTTP/1.1\r\nConnection: close\r\nHost: neuron.brainbox.winbot.co.uk\r\n\r\n"); if (n < 0) { - ServerInstance->Log(DEBUG,"Failed to send()"); + ServerInstance->Logs->Log("m_remoteinclude_http",DEBUG,"Failed to send()"); return 0; } - ServerInstance->Log(DEBUG,"Sent GET request"); + ServerInstance->Logs->Log("m_remoteinclude_http",DEBUG,"Sent GET request"); while (((n = read(sockfd,buffer,65535)) > 0)) { @@ -97,7 +97,7 @@ class ModuleRemoteIncludeHttp : public Module (*(gotfile)) << output; } - ServerInstance->Log(DEBUG,"Read page"); + ServerInstance->Logs->Log("m_remoteinclude_http",DEBUG,"Read page"); std::string version, result; (*(gotfile)) >> version; @@ -105,7 +105,7 @@ class ModuleRemoteIncludeHttp : public Module /* HTTP/1.1 200 OK */ - ServerInstance->Log(DEBUG,"Result: %s", result.c_str()); + ServerInstance->Logs->Log("m_remoteinclude_http",DEBUG,"Result: %s", result.c_str()); return (result == "200"); #endif diff --git a/src/modules/m_safelist.cpp b/src/modules/m_safelist.cpp index 889ecb0a6..ab2839900 100644 --- a/src/modules/m_safelist.cpp +++ b/src/modules/m_safelist.cpp @@ -114,13 +114,13 @@ class ModuleSafeList : public Module if (*parameters[0] == '<') { maxusers = atoi(parameters[0]+1); - ServerInstance->Log(DEBUG,"Max users: %d", maxusers); + ServerInstance->Logs->Log("m_safelist",DEBUG,"Max users: %d", maxusers); pcnt = 0; } else if (*parameters[0] == '>') { minusers = atoi(parameters[0]+1); - ServerInstance->Log(DEBUG,"Min users: %d", minusers); + ServerInstance->Logs->Log("m_safelist",DEBUG,"Min users: %d", minusers); pcnt = 0; } } diff --git a/src/modules/m_sapart.cpp b/src/modules/m_sapart.cpp index 1a176da85..f7807824f 100644 --- a/src/modules/m_sapart.cpp +++ b/src/modules/m_sapart.cpp @@ -35,7 +35,7 @@ class CommandSapart : public Command if (dest && channel) { - ServerInstance->Log(DEBUG, "SAPART: pcnt is %d", pcnt); + ServerInstance->Logs->Log("m_sapart",DEBUG, "SAPART: pcnt is %d", pcnt); if (pcnt == 3) reason = parameters[2]; else diff --git a/src/modules/m_spanningtree/fjoin.cpp b/src/modules/m_spanningtree/fjoin.cpp index 0b6c4430a..a4fe5836a 100644 --- a/src/modules/m_spanningtree/fjoin.cpp +++ b/src/modules/m_spanningtree/fjoin.cpp @@ -79,7 +79,7 @@ bool TreeSocket::ForceJoin(const std::string &source, std::deque<std::string> &p if (!TS) { - Instance->Log(DEFAULT,"*** BUG? *** TS of 0 sent to FJOIN. Are some services authors smoking craq, or is it 1970 again?. Dropped."); + Instance->Logs->Log("m_spanningtree",DEFAULT,"*** BUG? *** TS of 0 sent to FJOIN. Are some services authors smoking craq, or is it 1970 again?. Dropped."); Instance->SNO->WriteToSnoMask('d', "WARNING: The server %s is sending FJOIN with a TS of zero. Total craq. Command was dropped.", source.c_str()); return true; } @@ -148,7 +148,7 @@ bool TreeSocket::ForceJoin(const std::string &source, std::deque<std::string> &p } else { - Instance->Log(SPARSE,"Warning! Invalid user %s in FJOIN to channel %s IGNORED", usr, channel.c_str()); + Instance->Logs->Log("m_spanningtree",SPARSE,"Warning! Invalid user %s in FJOIN to channel %s IGNORED", usr, channel.c_str()); continue; } } diff --git a/src/modules/m_spanningtree/fmode.cpp b/src/modules/m_spanningtree/fmode.cpp index a6fbab164..260b4523c 100644 --- a/src/modules/m_spanningtree/fmode.cpp +++ b/src/modules/m_spanningtree/fmode.cpp @@ -90,7 +90,7 @@ bool TreeSocket::ForceMode(const std::string &source, std::deque<std::string> &p if (!TS) { - Instance->Log(DEFAULT,"*** BUG? *** TS of 0 sent to FMODE. Are some services authors smoking craq, or is it 1970 again?. Dropped."); + Instance->Logs->Log("m_spanningtree",DEFAULT,"*** BUG? *** TS of 0 sent to FMODE. Are some services authors smoking craq, or is it 1970 again?. Dropped."); Instance->SNO->WriteToSnoMask('d', "WARNING: The server %s is sending FMODE with a TS of zero. Total craq. Mode was dropped.", sourceserv.c_str()); return true; } @@ -100,7 +100,7 @@ bool TreeSocket::ForceMode(const std::string &source, std::deque<std::string> &p if (TS <= ourTS) { if ((TS < ourTS) && (!dst)) - Instance->Log(DEFAULT,"*** BUG *** Channel TS sent in FMODE to %s is %lu which is not equal to %lu!", params[0].c_str(), TS, ourTS); + Instance->Logs->Log("m_spanningtree",DEFAULT,"*** BUG *** Channel TS sent in FMODE to %s is %lu which is not equal to %lu!", params[0].c_str(), TS, ourTS); if (smode) { diff --git a/src/modules/m_spanningtree/hmac.cpp b/src/modules/m_spanningtree/hmac.cpp index 6632ea907..e01760dac 100644 --- a/src/modules/m_spanningtree/hmac.cpp +++ b/src/modules/m_spanningtree/hmac.cpp @@ -90,7 +90,7 @@ std::string TreeSocket::MakePass(const std::string &password, const std::string return "HMAC-SHA256:"+ hmac; } else if (!challenge.empty() && !sha256) - Instance->Log(DEFAULT,"Not authenticating to server using SHA256/HMAC because we don't have m_sha256 loaded!"); + Instance->Logs->Log("m_spanningtree",DEFAULT,"Not authenticating to server using SHA256/HMAC because we don't have m_sha256 loaded!"); return password; } diff --git a/src/modules/m_spanningtree/netburst.cpp b/src/modules/m_spanningtree/netburst.cpp index 062aed855..c2e365c35 100644 --- a/src/modules/m_spanningtree/netburst.cpp +++ b/src/modules/m_spanningtree/netburst.cpp @@ -188,7 +188,7 @@ void TreeSocket::SendChannelModes(TreeServer* Current) std::deque<std::string> list; std::string n = this->Instance->Config->GetSID(); const char* sn = n.c_str(); - Instance->Log(DEBUG,"Sending channels and modes, %d to send", this->Instance->chanlist->size()); + Instance->Logs->Log("m_spanningtree",DEBUG,"Sending channels and modes, %d to send", this->Instance->chanlist->size()); for (chan_hash::iterator c = this->Instance->chanlist->begin(); c != this->Instance->chanlist->end(); c++) { SendFJoins(Current, c->second); diff --git a/src/modules/m_spanningtree/postcommand.cpp b/src/modules/m_spanningtree/postcommand.cpp index de7142bea..d303ef322 100644 --- a/src/modules/m_spanningtree/postcommand.cpp +++ b/src/modules/m_spanningtree/postcommand.cpp @@ -66,7 +66,7 @@ void ModuleSpanningTree::OnPostCommand(const std::string &command, const char* c else translate_to = TR_TEXT; - ServerInstance->Log(DEBUG,"TRANSLATION: %s - type is %d", parameters[j], translate_to); + ServerInstance->Logs->Log("m_spanningtree",DEBUG,"TRANSLATION: %s - type is %d", parameters[j], translate_to); ServerInstance->Parser->TranslateUIDs(translate_to, parameters[j], target); if (j == (pcnt - 1)) diff --git a/src/modules/m_spanningtree/resolvers.h b/src/modules/m_spanningtree/resolvers.h index 6ca6a5746..54fd9c481 100644 --- a/src/modules/m_spanningtree/resolvers.h +++ b/src/modules/m_spanningtree/resolvers.h @@ -55,7 +55,7 @@ class SecurityIPResolver : public Resolver ServerInstance->AddResolver(res, cached); return; } - ServerInstance->Log(DEFAULT,"Could not resolve IP associated with Link '%s': %s",MyLink.Name.c_str(),errormessage.c_str()); + ServerInstance->Logs->Log("m_spanningtree",DEFAULT,"Could not resolve IP associated with Link '%s': %s",MyLink.Name.c_str(),errormessage.c_str()); } }; diff --git a/src/modules/m_spanningtree/server.cpp b/src/modules/m_spanningtree/server.cpp index cbbc7190a..d98d73050 100644 --- a/src/modules/m_spanningtree/server.cpp +++ b/src/modules/m_spanningtree/server.cpp @@ -212,7 +212,7 @@ bool TreeSocket::Inbound_Server(std::deque<std::string> ¶ms) if ((x->Name == servername) && ((ComparePass(this->MakePass(x->RecvPass,this->GetOurChallenge()),password) || x->RecvPass == password && (this->GetTheirChallenge().empty())))) { /* Check for fully initialized instances of the server by id */ - Instance->Log(DEBUG,"Looking for dupe SID %s", sid.c_str()); + Instance->Logs->Log("m_spanningtree",DEBUG,"Looking for dupe SID %s", sid.c_str()); TreeServer* CheckDupeSID = Utils->FindServerID(sid); if (CheckDupeSID) { diff --git a/src/modules/m_spanningtree/treeserver.cpp b/src/modules/m_spanningtree/treeserver.cpp index 5c85e5e5d..db26b3f88 100644 --- a/src/modules/m_spanningtree/treeserver.cpp +++ b/src/modules/m_spanningtree/treeserver.cpp @@ -77,7 +77,7 @@ TreeServer::TreeServer(SpanningTreeUtilities* Util, InspIRCd* Instance, std::str gettimeofday(&t, NULL); long ts = (t.tv_sec * 1000) + (t.tv_usec / 1000); this->StartBurst = ts; - Instance->Log(DEBUG, "Started bursting at time %lu", ts); + Instance->Logs->Log("m_spanningtree",DEBUG, "Started bursting at time %lu", ts); /* find the 'route' for this server (e.g. the one directly connected * to the local server, which we can use to reach it) @@ -156,7 +156,7 @@ void TreeServer::FinishBurst() void TreeServer::SetID(const std::string &id) { - ServerInstance->Log(DEBUG, "Setting SID to " + id); + ServerInstance->Logs->Log("m_spanningtree",DEBUG, "Setting SID to " + id); sid = id; server_hash::iterator iter = Utils->sidlist.find(sid); if (iter == Utils->sidlist.end()) diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp index 34b8e112d..eed4383d0 100644 --- a/src/modules/m_spanningtree/treesocket1.cpp +++ b/src/modules/m_spanningtree/treesocket1.cpp @@ -245,7 +245,7 @@ void TreeSocket::Squit(TreeServer* Current, const std::string &reason) this->Instance->SNO->WriteToSnoMask('l',"Netsplit complete, lost \002%d\002 users on \002%d\002 servers.", num_lost_users, num_lost_servers); } else - Instance->Log(DEFAULT,"Squit from unknown server"); + Instance->Logs->Log("m_spanningtree",DEFAULT,"Squit from unknown server"); } /** This function is called when we receive data from a remote diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index 76920d6e6..023fa0ac8 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -34,7 +34,7 @@ static std::map<std::string, std::string> warned; /* Server names that hav int TreeSocket::WriteLine(std::string line) { - Instance->Log(DEBUG, "S[%d] O %s", this->GetFd(), line.c_str()); + Instance->Logs->Log("m_spanningtree",DEBUG, "S[%d] O %s", this->GetFd(), line.c_str()); line.append("\r\n"); return this->Write(line); } @@ -73,7 +73,7 @@ bool TreeSocket::ProcessLine(std::string &line) if (line.empty()) return true; - Instance->Log(DEBUG, "S[%d] I %s", this->GetFd(), line.c_str()); + Instance->Logs->Log("m_spanningtree",DEBUG, "S[%d] I %s", this->GetFd(), line.c_str()); this->Split(line.c_str(),params); @@ -268,7 +268,7 @@ bool TreeSocket::ProcessLine(std::string &line) if ((!route_back_again) || (route_back_again->GetSocket() != this)) { if (route_back_again) - Instance->Log(DEBUG,"Protocol violation: Fake direction in command '%s' from connection '%s'",line.c_str(),this->GetName().c_str()); + Instance->Logs->Log("m_spanningtree",DEBUG,"Protocol violation: Fake direction in command '%s' from connection '%s'",line.c_str(),this->GetName().c_str()); return true; } /* Fix by brain: @@ -308,7 +308,7 @@ bool TreeSocket::ProcessLine(std::string &line) { if (warned.find(x->server) == warned.end()) { - Instance->Log(DEFAULT,"WARNING: I revceived modes '%s' from another server '%s'. This is not compliant with InspIRCd. Please check that server for bugs.", params[1].c_str(), x->server); + Instance->Logs->Log("m_spanningtree",DEFAULT,"WARNING: I revceived modes '%s' from another server '%s'. This is not compliant with InspIRCd. Please check that server for bugs.", params[1].c_str(), x->server); Instance->SNO->WriteToSnoMask('d', "WARNING: The server %s is sending nonstandard modes: '%s MODE %s' where FMODE should be used, and may cause desyncs.", x->server, x->nick, params[1].c_str()); warned[x->server] = x->nick; } diff --git a/src/modules/m_spanningtree/uid.cpp b/src/modules/m_spanningtree/uid.cpp index 0768ec16f..62059f99c 100644 --- a/src/modules/m_spanningtree/uid.cpp +++ b/src/modules/m_spanningtree/uid.cpp @@ -84,7 +84,7 @@ bool TreeSocket::ParseUID(const std::string &source, std::deque<std::string> &pa /* * Nick collision. */ - Instance->Log(DEBUG,"*** Collision on %s", tempnick); + Instance->Logs->Log("m_spanningtree",DEBUG,"*** Collision on %s", tempnick); int collide = this->DoCollision(iter->second, age_t, params[5].c_str(), params[7].c_str(), params[0].c_str()); if (collide == 2) diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp index fb4a81ba1..7480923b6 100644 --- a/src/modules/m_spanningtree/utils.cpp +++ b/src/modules/m_spanningtree/utils.cpp @@ -433,12 +433,12 @@ void SpanningTreeUtilities::ReadConfiguration(bool rebind) TreeSocket* listener = new TreeSocket(this, ServerInstance, IP.c_str(), portno, true, 10, transport.empty() ? NULL : hooks[transport.c_str()]); if (listener->GetState() == I_LISTENING) { - ServerInstance->Log(DEFAULT,"m_spanningtree: Binding server port %s:%d successful!", IP.c_str(), portno); + ServerInstance->Logs->Log("m_spanningtree",DEFAULT,"m_spanningtree: Binding server port %s:%d successful!", IP.c_str(), portno); Bindings.push_back(listener); } else { - ServerInstance->Log(DEFAULT,"m_spanningtree: Warning: Failed to bind server port: %s:%d: %s",IP.c_str(), portno, strerror(errno)); + ServerInstance->Logs->Log("m_spanningtree",DEFAULT,"m_spanningtree: Warning: Failed to bind server port: %s:%d: %s",IP.c_str(), portno, strerror(errno)); listener->Close(); } } @@ -588,7 +588,7 @@ void SpanningTreeUtilities::DoFailOver(Link* x) TreeServer* CheckDupe = this->FindServer(x->FailOver.c_str()); if (CheckDupe) { - ServerInstance->Log(DEBUG,"Skipping existing failover: %s", x->FailOver.c_str()); + ServerInstance->Logs->Log("m_spanningtree",DEBUG,"Skipping existing failover: %s", x->FailOver.c_str()); } else { diff --git a/src/modules/m_svshold.cpp b/src/modules/m_svshold.cpp index 4701a717b..a10125429 100644 --- a/src/modules/m_svshold.cpp +++ b/src/modules/m_svshold.cpp @@ -260,7 +260,7 @@ class ModuleSVSHold : public Module { if ((*iter)->set_on + (*iter)->length <= ServerInstance->Time()) { - ServerInstance->Log(DEBUG, "m_svshold.so: hold on %s expired, removing...", (*iter)->nickname.c_str()); + ServerInstance->Logs->Log("m_svshold",DEBUG, "m_svshold.so: hold on %s expired, removing...", (*iter)->nickname.c_str()); ServerInstance->SNO->WriteToSnoMask('A',"%li second SVSHOLD on %s (%s) set %u seconds ago expired", (*iter)->length, (*iter)->nickname.c_str(), (*iter)->reason.c_str(), ServerInstance->Time() - (*iter)->set_on); HoldMap.erase(assign((*iter)->nickname)); delete *iter; diff --git a/src/modules/m_xline_db.cpp b/src/modules/m_xline_db.cpp index 5b4553ab7..de6582798 100644 --- a/src/modules/m_xline_db.cpp +++ b/src/modules/m_xline_db.cpp @@ -43,7 +43,7 @@ class ModuleXLineDB : public Module */ void OnAddLine(User* source, XLine* line) { - ServerInstance->Log(DEBUG, "xlinedb: Adding a line"); + ServerInstance->Logs->Log("m_xline_db",DEBUG, "xlinedb: Adding a line"); xlines.push_back(line); if (!reading_db) @@ -69,7 +69,7 @@ class ModuleXLineDB : public Module void RemoveLine(XLine *line) { - ServerInstance->Log(DEBUG, "xlinedb: Removing a line"); + ServerInstance->Logs->Log("m_xline_db",DEBUG, "xlinedb: Removing a line"); for (std::vector<XLine *>::iterator i = xlines.begin(); i != xlines.end(); i++) { if ((*i) == line) @@ -92,16 +92,16 @@ class ModuleXLineDB : public Module * Technically, that means that this can block, but I have *never* seen that. * -- w00t */ - ServerInstance->Log(DEBUG, "xlinedb: Opening temporary database"); + ServerInstance->Logs->Log("m_xline_db",DEBUG, "xlinedb: Opening temporary database"); f = fopen("xline.db.new", "w"); if (!f) { - ServerInstance->Log(DEBUG, "xlinedb: Cannot create database! %s (%d)", strerror(errno), errno); + ServerInstance->Logs->Log("m_xline_db",DEBUG, "xlinedb: Cannot create database! %s (%d)", strerror(errno), errno); ServerInstance->SNO->WriteToSnoMask('x', "database: cannot create new db: %s (%d)", strerror(errno), errno); return false; } - ServerInstance->Log(DEBUG, "xlinedb: Opened. Writing.."); + ServerInstance->Logs->Log("m_xline_db",DEBUG, "xlinedb: Opened. Writing.."); /* * Now, much as I hate writing semi-unportable formats, additional @@ -121,14 +121,14 @@ class ModuleXLineDB : public Module ServerInstance->Config->ServerName, line->set_time, line->duration, line->reason); } - ServerInstance->Log(DEBUG, "xlinedb: Finished writing XLines. Checking for error.."); + ServerInstance->Logs->Log("m_xline_db",DEBUG, "xlinedb: Finished writing XLines. Checking for error.."); int write_error = 0; write_error = ferror(f); write_error |= fclose(f); if (write_error) { - ServerInstance->Log(DEBUG, "xlinedb: Cannot write to new database! %s (%d)", strerror(errno), errno); + ServerInstance->Logs->Log("m_xline_db",DEBUG, "xlinedb: Cannot write to new database! %s (%d)", strerror(errno), errno); ServerInstance->SNO->WriteToSnoMask('x', "database: cannot write to new db: %s (%d)", strerror(errno), errno); return false; } @@ -136,7 +136,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("xline.db.new", "xline.db") < 0) { - ServerInstance->Log(DEBUG, "xlinedb: Cannot move new to old database! %s (%d)", strerror(errno), errno); + ServerInstance->Logs->Log("m_xline_db",DEBUG, "xlinedb: Cannot move new to old database! %s (%d)", strerror(errno), errno); ServerInstance->SNO->WriteToSnoMask('x', "database: cannot replace old with new db: %s (%d)", strerror(errno), errno); return false; } @@ -161,7 +161,7 @@ class ModuleXLineDB : public Module else { /* this might be slightly more problematic. */ - ServerInstance->Log(DEBUG, "xlinedb: Cannot read database! %s (%d)", strerror(errno), errno); + ServerInstance->Logs->Log("m_xline_db",DEBUG, "xlinedb: Cannot read database! %s (%d)", strerror(errno), errno); ServerInstance->SNO->WriteToSnoMask('x', "database: cannot read db: %s (%d)", strerror(errno), errno); return false; } @@ -195,18 +195,18 @@ class ModuleXLineDB : public Module items++; } - ServerInstance->Log(DEBUG, "xlinedb: Processing %s", linebuf); + ServerInstance->Logs->Log("m_xline_db",DEBUG, "xlinedb: Processing %s", linebuf); if (command_p[0] == "VERSION") { if (command_p[1] == "1") { - ServerInstance->Log(DEBUG, "xlinedb: Reading db version %s", command_p[1].c_str()); + ServerInstance->Logs->Log("m_xline_db",DEBUG, "xlinedb: Reading db version %s", command_p[1].c_str()); } else { fclose(f); - ServerInstance->Log(DEBUG, "xlinedb: I got database version %s - I don't understand it", command_p[1].c_str()); + ServerInstance->Logs->Log("m_xline_db",DEBUG, "xlinedb: 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/modules/m_xmlsocket.cpp b/src/modules/m_xmlsocket.cpp index b18904ed8..cacd1f348 100644 --- a/src/modules/m_xmlsocket.cpp +++ b/src/modules/m_xmlsocket.cpp @@ -65,12 +65,12 @@ class ModuleXMLSocket : public Module } else { - ServerInstance->Log(DEFAULT, "m_xmlsocket.so: FAILED to enable XMLSocket on port %d, maybe you have another similar module loaded?", portno); + ServerInstance->Logs->Log("m_xmlsocket",DEFAULT, "m_xmlsocket.so: FAILED to enable XMLSocket on port %d, maybe you have another similar module loaded?", portno); } } catch (ModuleException &e) { - ServerInstance->Log(DEFAULT, "m_xmlsocket.so: FAILED to enable XMLSocket on port %d: %s. Maybe it's already hooked by the same port on a different IP, or you have another similar module loaded?", portno, e.GetReason()); + ServerInstance->Logs->Log("m_xmlsocket",DEFAULT, "m_xmlsocket.so: FAILED to enable XMLSocket on port %d: %s. Maybe it's already hooked by the same port on a different IP, or you have another similar module loaded?", portno, e.GetReason()); } } } diff --git a/src/socket.cpp b/src/socket.cpp index 81f2a6f27..e045df1f9 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -58,9 +58,9 @@ ListenSocket::~ListenSocket() if (this->GetFd() > -1) { ServerInstance->SE->DelFd(this); - ServerInstance->Log(DEBUG,"Shut down listener on fd %d", this->fd); + ServerInstance->Logs->Log("SOCKET", DEBUG,"Shut down listener on fd %d", this->fd); if (ServerInstance->SE->Shutdown(this, 2) || ServerInstance->SE->Close(this)) - ServerInstance->Log(DEBUG,"Failed to cancel listener: %s", strerror(errno)); + ServerInstance->Logs->Log("SOCKET", DEBUG,"Failed to cancel listener: %s", strerror(errno)); this->fd = -1; } } @@ -124,7 +124,7 @@ void ListenSocket::HandleEvent(EventType, int) } catch (CoreException& modexcept) { - ServerInstance->Log(DEBUG,"%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason()); + ServerInstance->Logs->Log("SOCKET", DEBUG,"%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason()); } } ServerInstance->stats->statsAccept++; @@ -412,19 +412,19 @@ bool InspIRCd::BindSocket(int sockfd, int port, const char* addr, bool dolisten) { if (SE->Listen(sockfd, Config->MaxConn) == -1) { - this->Log(DEFAULT,"ERROR in listen(): %s",strerror(errno)); + this->Logs->Log("SOCKET",DEFAULT,"ERROR in listen(): %s",strerror(errno)); return false; } else { - this->Log(DEBUG,"New socket binding for %d with listen: %s:%d", sockfd, addr, port); + this->Logs->Log("SOCKET",DEBUG,"New socket binding for %d with listen: %s:%d", sockfd, addr, port); SE->NonBlocking(sockfd); return true; } } else { - this->Log(DEBUG,"New socket binding for %d without listen: %s:%d", sockfd, addr, port); + this->Logs->Log("SOCKET",DEBUG,"New socket binding for %d without listen: %s:%d", sockfd, addr, port); return true; } } @@ -478,7 +478,7 @@ int InspIRCd::BindPorts(bool, int &ports_found, FailedPortList &failed_ports) Config->ConfValue(Config->config_data, "bind", "type", count, Type, MAXBUF); if (strncmp(Addr, "::ffff:", 7) == 0) - this->Log(DEFAULT, "Using 4in6 (::ffff:) isn't recommended. You should bind IPv4 addresses directly instead."); + this->Logs->Log("SOCKET",DEFAULT, "Using 4in6 (::ffff:) isn't recommended. You should bind IPv4 addresses directly instead."); if ((!*Type) || (!strcmp(Type,"clients"))) { @@ -533,7 +533,7 @@ int InspIRCd::BindPorts(bool, int &ports_found, FailedPortList &failed_ports) { if (((*n)->GetIP() == old_ports[k].first) && ((*n)->GetPort() == old_ports[k].second)) { - this->Log(DEFAULT,"Port binding %s:%d was removed from the config file, closing.", old_ports[k].first.c_str(), old_ports[k].second); + this->Logs->Log("SOCKET",DEFAULT,"Port binding %s:%d was removed from the config file, closing.", old_ports[k].first.c_str(), old_ports[k].second); delete *n; Config->ports.erase(n); break; diff --git a/src/socketengines/socketengine_epoll.cpp b/src/socketengines/socketengine_epoll.cpp index ccfa0f769..1a0c5d53e 100644 --- a/src/socketengines/socketengine_epoll.cpp +++ b/src/socketengines/socketengine_epoll.cpp @@ -22,8 +22,8 @@ EPollEngine::EPollEngine(InspIRCd* Instance) : SocketEngine(Instance) if (EngineHandle == -1) { - ServerInstance->Log(DEFAULT, "ERROR: Could not initialize socket engine: %s", strerror(errno)); - ServerInstance->Log(DEFAULT, "ERROR: Your kernel probably does not have the proper features. This is a fatal error, exiting now."); + ServerInstance->Logs->Log("SOCKET",DEFAULT, "ERROR: Could not initialize socket engine: %s", strerror(errno)); + ServerInstance->Logs->Log("SOCKET",DEFAULT, "ERROR: Your kernel probably does not have the proper features. This is a fatal error, exiting now."); printf("ERROR: Could not initialize socket engine: %s\n", strerror(errno)); printf("ERROR: Your kernel probably does not have the proper features. This is a fatal error, exiting now.\n"); ServerInstance->Exit(EXIT_STATUS_SOCKETENGINE); @@ -41,7 +41,7 @@ bool EPollEngine::AddFd(EventHandler* eh) int fd = eh->GetFd(); if ((fd < 0) || (fd > MAX_DESCRIPTORS)) { - ServerInstance->Log(DEBUG,"Out of range FD"); + ServerInstance->Logs->Log("SOCKET",DEBUG,"Out of range FD"); return false; } @@ -61,7 +61,7 @@ bool EPollEngine::AddFd(EventHandler* eh) return false; } - ServerInstance->Log(DEBUG,"New file descriptor: %d", fd); + ServerInstance->Logs->Log("SOCKET",DEBUG,"New file descriptor: %d", fd); ref[fd] = eh; CurrentSetSize++; @@ -94,14 +94,14 @@ bool EPollEngine::DelFd(EventHandler* eh, bool force) if (i < 0 && !force) { - ServerInstance->Log(DEBUG,"Cant remove socket: %s", strerror(errno)); + ServerInstance->Logs->Log("SOCKET",DEBUG,"Cant remove socket: %s", strerror(errno)); return false; } ref[fd] = NULL; CurrentSetSize--; - ServerInstance->Log(DEBUG,"Remove file descriptor: %d", fd); + ServerInstance->Logs->Log("SOCKET",DEBUG,"Remove file descriptor: %d", fd); return true; } diff --git a/src/socketengines/socketengine_iocp.cpp b/src/socketengines/socketengine_iocp.cpp index 9b7dd63c7..5bc1faed4 100644 --- a/src/socketengines/socketengine_iocp.cpp +++ b/src/socketengines/socketengine_iocp.cpp @@ -22,8 +22,8 @@ IOCPEngine::IOCPEngine(InspIRCd * Instance) : SocketEngine(Instance) if (!m_completionPort) { - ServerInstance->Log(DEFAULT, "ERROR: Could not initialize socket engine. Your kernel probably does not have the proper features."); - ServerInstance->Log(DEFAULT, "ERROR: this is a fatal error, exiting now."); + ServerInstance->Logs->Log("SOCKET",DEFAULT, "ERROR: Could not initialize socket engine. Your kernel probably does not have the proper features."); + ServerInstance->Logs->Log("SOCKET",DEFAULT, "ERROR: this is a fatal error, exiting now."); printf("ERROR: Could not initialize socket engine. Your kernel probably does not have the proper features.\n"); printf("ERROR: this is a fatal error, exiting now.\n"); ServerInstance->Exit(EXIT_STATUS_SOCKETENGINE); @@ -84,7 +84,7 @@ bool IOCPEngine::AddFd(EventHandler* eh) PostReadEvent(eh); /* log message */ - ServerInstance->Log(DEBUG, "New fake fd: %u, real fd: %u, address 0x%p", *fake_fd, eh->GetFd(), eh); + ServerInstance->Logs->Log("SOCKET",DEBUG, "New fake fd: %u, real fd: %u, address 0x%p", *fake_fd, eh->GetFd(), eh); /* post a write event if there is data to be written */ if(eh->Writeable()) @@ -123,7 +123,7 @@ bool IOCPEngine::DelFd(EventHandler* eh, bool force /* = false */) void* m_writeEvent = NULL; void* m_acceptEvent = NULL; - ServerInstance->Log(DEBUG, "Removing fake fd %u, real fd %u, address 0x%p", *fake_fd, eh->GetFd(), eh); + ServerInstance->Logs->Log("SOCKET",DEBUG, "Removing fake fd %u, real fd %u, address 0x%p", *fake_fd, eh->GetFd(), eh); /* Cancel pending i/o operations. */ if (CancelIo((HANDLE)fd) == FALSE) diff --git a/src/socketengines/socketengine_kqueue.cpp b/src/socketengines/socketengine_kqueue.cpp index a2bbd5afe..f245830de 100644 --- a/src/socketengines/socketengine_kqueue.cpp +++ b/src/socketengines/socketengine_kqueue.cpp @@ -34,8 +34,8 @@ void KQueueEngine::RecoverFromFork() EngineHandle = kqueue(); if (EngineHandle == -1) { - ServerInstance->Log(DEFAULT, "ERROR: Could not initialize socket engine. Your kernel probably does not have the proper features."); - ServerInstance->Log(DEFAULT, "ERROR: this is a fatal error, exiting now."); + ServerInstance->Logs->Log("SOCKET",DEFAULT, "ERROR: Could not initialize socket engine. Your kernel probably does not have the proper features."); + ServerInstance->Logs->Log("SOCKET",DEFAULT, "ERROR: this is a fatal error, exiting now."); printf("ERROR: Could not initialize socket engine. Your kernel probably does not have the proper features.\n"); printf("ERROR: this is a fatal error, exiting now.\n"); ServerInstance->Exit(EXIT_STATUS_SOCKETENGINE); @@ -73,7 +73,7 @@ bool KQueueEngine::AddFd(EventHandler* eh) ref[fd] = eh; CurrentSetSize++; - ServerInstance->Log(DEBUG,"New file descriptor: %d", fd); + ServerInstance->Logs->Log("SOCKET",DEBUG,"New file descriptor: %d", fd); return true; } @@ -99,7 +99,7 @@ bool KQueueEngine::DelFd(EventHandler* eh, bool force) CurrentSetSize--; ref[fd] = NULL; - ServerInstance->Log(DEBUG,"Remove file descriptor: %d", fd); + ServerInstance->Logs->Log("SOCKET",DEBUG,"Remove file descriptor: %d", fd); return true; } diff --git a/src/socketengines/socketengine_ports.cpp b/src/socketengines/socketengine_ports.cpp index 0d97b91df..767ea0df0 100644 --- a/src/socketengines/socketengine_ports.cpp +++ b/src/socketengines/socketengine_ports.cpp @@ -22,8 +22,8 @@ PortsEngine::PortsEngine(InspIRCd* Instance) : SocketEngine(Instance) if (EngineHandle == -1) { - ServerInstance->Log(SPARSE,"ERROR: Could not initialize socket engine: %s", strerror(errno)); - ServerInstance->Log(SPARSE,"ERROR: This is a fatal error, exiting now."); + ServerInstance->Logs->Log("SOCKET",SPARSE,"ERROR: Could not initialize socket engine: %s", strerror(errno)); + ServerInstance->Logs->Log("SOCKET",SPARSE,"ERROR: This is a fatal error, exiting now."); printf("ERROR: Could not initialize socket engine: %s\n", strerror(errno)); printf("ERROR: This is a fatal error, exiting now.\n"); ServerInstance->Exit(EXIT_STATUS_SOCKETENGINE); @@ -51,7 +51,7 @@ bool PortsEngine::AddFd(EventHandler* eh) ref[fd] = eh; port_associate(EngineHandle, PORT_SOURCE_FD, fd, eh->Readable() ? POLLRDNORM : POLLWRNORM, eh); - ServerInstance->Log(DEBUG,"New file descriptor: %d", fd); + ServerInstance->Logs->Log("SOCKET",DEBUG,"New file descriptor: %d", fd); CurrentSetSize++; return true; } @@ -72,7 +72,7 @@ bool PortsEngine::DelFd(EventHandler* eh, bool force) CurrentSetSize--; ref[fd] = NULL; - ServerInstance->Log(DEBUG,"Remove file descriptor: %d", fd); + ServerInstance->Logs->Log("SOCKET",DEBUG,"Remove file descriptor: %d", fd); return true; } diff --git a/src/socketengines/socketengine_select.cpp b/src/socketengines/socketengine_select.cpp index cc7232b99..8ee381877 100644 --- a/src/socketengines/socketengine_select.cpp +++ b/src/socketengines/socketengine_select.cpp @@ -45,7 +45,7 @@ bool SelectEngine::AddFd(EventHandler* eh) ref[fd] = eh; CurrentSetSize++; - ServerInstance->Log(DEBUG,"New file descriptor: %d", fd); + ServerInstance->Logs->Log("SOCKET",DEBUG,"New file descriptor: %d", fd); return true; } @@ -69,7 +69,7 @@ bool SelectEngine::DelFd(EventHandler* eh, bool force) ref[fd] = NULL; fds[fd] = 0; - ServerInstance->Log(DEBUG,"Remove file descriptor: %d", fd); + ServerInstance->Logs->Log("SOCKET",DEBUG,"Remove file descriptor: %d", fd); return true; } diff --git a/src/user_resolver.cpp b/src/user_resolver.cpp index ea3b46272..3f010df03 100644 --- a/src/user_resolver.cpp +++ b/src/user_resolver.cpp @@ -54,7 +54,7 @@ void UserResolver::OnLookupComplete(const std::string &result, unsigned int ttl, } catch (CoreException& e) { - ServerInstance->Log(DEBUG,"Error in resolver: %s",e.GetReason()); + ServerInstance->Logs->Log("RESOLVER", DEBUG,"Error in resolver: %s",e.GetReason()); } } else if ((this->fwd) && (ServerInstance->SE->GetRef(this->bound_fd) == this->bound_user)) diff --git a/src/usermanager.cpp b/src/usermanager.cpp index ca9736f1e..6145c887b 100644 --- a/src/usermanager.cpp +++ b/src/usermanager.cpp @@ -30,12 +30,12 @@ void UserManager::AddClient(InspIRCd* Instance, int socket, int port, bool iscac } catch (...) { - Instance->Log(DEFAULT,"*** WTF *** Duplicated UUID! -- Crack smoking monkies have been unleashed."); + Instance->Logs->Log("USERS", DEFAULT,"*** WTF *** Duplicated UUID! -- Crack smoking monkies have been unleashed."); Instance->SNO->WriteToSnoMask('A', "WARNING *** Duplicate UUID allocated!"); return; } - Instance->Log(DEBUG,"New user fd: %d", socket); + Instance->Logs->Log("USERS", DEBUG,"New user fd: %d", socket); int j = 0; @@ -130,7 +130,7 @@ void UserManager::AddClient(InspIRCd* Instance, int socket, int port, bool iscac if (!b->Type.empty() && !New->exempt) { /* user banned */ - Instance->Log(DEBUG, std::string("BanCache: Positive hit for ") + New->GetIPString()); + Instance->Logs->Log("BANCACHE", DEBUG, std::string("BanCache: Positive hit for ") + New->GetIPString()); if (*Instance->Config->MoronBanner) New->WriteServ("NOTICE %s :*** %s", New->nick, Instance->Config->MoronBanner); User::QuitUser(Instance, New, b->Reason); @@ -138,7 +138,7 @@ void UserManager::AddClient(InspIRCd* Instance, int socket, int port, bool iscac } else { - Instance->Log(DEBUG, std::string("BanCache: Negative hit for ") + New->GetIPString()); + Instance->Logs->Log("BANCACHE", DEBUG, std::string("BanCache: Negative hit for ") + New->GetIPString()); } } else @@ -157,7 +157,7 @@ void UserManager::AddClient(InspIRCd* Instance, int socket, int port, bool iscac if (!Instance->SE->AddFd(New)) { - Instance->Log(DEBUG,"Internal error on new connection"); + Instance->Logs->Log("USERS", DEBUG,"Internal error on new connection"); User::QuitUser(Instance, New, "Internal error handling connection"); } @@ -321,7 +321,7 @@ void UserManager::WriteMode(const char* modes, int flags, const char* text, ...) if (!text || !modes || !flags) { - ServerInstance->Log(DEFAULT,"*** BUG *** WriteMode was given an invalid parameter"); + ServerInstance->Logs->Log("USERS", DEFAULT,"*** BUG *** WriteMode was given an invalid parameter"); return; } diff --git a/src/userprocess.cpp b/src/userprocess.cpp index 3ba09a759..62cd452cd 100644 --- a/src/userprocess.cpp +++ b/src/userprocess.cpp @@ -21,7 +21,7 @@ void FloodQuitUserHandler::Call(User* current) { - Server->Log(DEFAULT,"Excess flood from: %s@%s", current->ident, current->host); + Server->Logs->Log("USERS",DEFAULT,"Excess flood from: %s@%s", current->ident, current->host); Server->SNO->WriteToSnoMask('f',"Excess flood from: %s%s%s@%s", current->registered == REG_ALL ? current->nick : "", current->registered == REG_ALL ? "!" : "", current->ident, current->host); @@ -57,7 +57,7 @@ void ProcessUserHandler::Call(User* cu) } catch (CoreException& modexcept) { - Server->Log(DEBUG, "%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason()); + Server->Logs->Log("USERS",DEBUG, "%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason()); } if (MOD_RESULT < 0) diff --git a/src/users.cpp b/src/users.cpp index 8fdf336cc..f1c3a3fef 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -692,7 +692,7 @@ void User::Oper(const std::string &opertype, const std::string &opername) catch (...) { - ServerInstance->Log(DEBUG,"Exception in User::Oper()"); + ServerInstance->Logs->Log("OPER", DEBUG,"Exception in User::Oper()"); } } @@ -958,7 +958,7 @@ void User::SetSockAddr(int protocol_family, const char* sip, int port) } break; default: - ServerInstance->Log(DEBUG,"Uh oh, I dont know protocol %d to be set on '%s'!", protocol_family, this->nick); + ServerInstance->Logs->Log("USERS",DEBUG,"Uh oh, I dont know protocol %d to be set on '%s'!", protocol_family, this->nick); break; } } @@ -1070,7 +1070,7 @@ void User::Write(std::string text) } catch (...) { - ServerInstance->Log(DEBUG,"Exception in User::Write() std::string::append"); + ServerInstance->Logs->Log("USEROUTPUT", DEBUG,"Exception in User::Write() std::string::append"); return; } @@ -1085,7 +1085,7 @@ void User::Write(std::string text) } catch (CoreException& modexcept) { - ServerInstance->Log(DEBUG, "%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason()); + ServerInstance->Logs->Log("USEROUTPUT", DEBUG, "%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason()); } } else @@ -1590,7 +1590,7 @@ ConnectClass* User::SetClass(const std::string &explicit_name) /* deny change if change will take class over the limit */ if (found->limit && (found->RefCount + 1 >= found->limit)) { - ServerInstance->Log(DEBUG, "OOPS: Connect class limit (%u) hit, denying", found->limit); + ServerInstance->Logs->Log("USERS", DEBUG, "OOPS: Connect class limit (%u) hit, denying", found->limit); return this->MyClass; } @@ -1600,12 +1600,12 @@ ConnectClass* User::SetClass(const std::string &explicit_name) if (found == this->MyClass) // no point changing this shit :P return this->MyClass; this->MyClass->RefCount--; - ServerInstance->Log(DEBUG, "Untying user from connect class -- refcount: %u", this->MyClass->RefCount); + ServerInstance->Logs->Log("USERS", DEBUG, "Untying user from connect class -- refcount: %u", this->MyClass->RefCount); } this->MyClass = found; this->MyClass->RefCount++; - ServerInstance->Log(DEBUG, "User tied to new class -- connect refcount now: %u", this->MyClass->RefCount); + ServerInstance->Logs->Log("USERS", DEBUG, "User tied to new class -- connect refcount now: %u", this->MyClass->RefCount); } return this->MyClass; @@ -1638,7 +1638,7 @@ void User::PurgeEmptyChannels() } catch (...) { - ServerInstance->Log(DEBUG,"Exception in User::PurgeEmptyChannels to_delete.push_back()"); + ServerInstance->Logs->Log("USERS", DEBUG,"Exception in User::PurgeEmptyChannels to_delete.push_back()"); } } } @@ -1716,7 +1716,7 @@ void User::HandleEvent(EventType et, int errornum) } catch (...) { - ServerInstance->Log(DEBUG,"Exception in User::HandleEvent intercepted"); + ServerInstance->Logs->Log("USERS", DEBUG,"Exception in User::HandleEvent intercepted"); } /* If the user has raised an error whilst being processed, quit them now we're safe to */ diff --git a/src/xline.cpp b/src/xline.cpp index 547a54fea..19a15decf 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -410,7 +410,7 @@ void XLine::DefaultApply(User* u, const std::string &line, bool bancache) if (bancache) { - ServerInstance->Log(DEBUG, std::string("BanCache: Adding positive hit (") + line + ") for " + u->GetIPString()); + ServerInstance->Logs->Log("BANCACHE", DEBUG, std::string("BanCache: Adding positive hit (") + line + ") for " + u->GetIPString()); ServerInstance->BanCache->AddHit(u->GetIPString(), this->type, line + "-Lined: " + this->reason); } } |