diff options
78 files changed, 357 insertions, 358 deletions
diff --git a/include/filelogger.h b/include/filelogger.h index 22a94c934..739e4d94b 100644 --- a/include/filelogger.h +++ b/include/filelogger.h @@ -23,19 +23,18 @@ #include "logger.h" -/** Debug levels for use with InspIRCd::Log() +/** Logging levels for use with InspIRCd::Log() * */ -enum DebugLevel +enum LogLevel { - RAWIO = 5, - DEBUG = 10, - VERBOSE = 20, - DEFAULT = 30, - SPARSE = 40, - NONE = 50 + LOG_RAWIO = 5, + LOG_DEBUG = 10, + LOG_VERBOSE = 20, + LOG_DEFAULT = 30, + LOG_SPARSE = 40, + LOG_NONE = 50 }; - /* Forward declaration -- required */ class InspIRCd; diff --git a/include/logger.h b/include/logger.h index 0fa4bc7cd..eee964e15 100644 --- a/include/logger.h +++ b/include/logger.h @@ -199,14 +199,14 @@ class CoreExport LogManager /** Logs an event, sending it to all LogStreams registered for the type. * @param type Log message type (ex: "USERINPUT", "MODULE", ...) - * @param loglevel Log message level (DEBUG, VERBOSE, DEFAULT, SPARSE, NONE) + * @param loglevel Log message level (LOG_DEBUG, LOG_VERBOSE, LOG_DEFAULT, LOG_SPARSE, LOG_NONE) * @param msg The message to be logged (literal). */ void Log(const std::string &type, int loglevel, const std::string &msg); /** Logs an event, sending it to all LogStreams registered for the type. * @param type Log message type (ex: "USERINPUT", "MODULE", ...) - * @param loglevel Log message level (DEBUG, VERBOSE, DEFAULT, SPARSE, NONE) + * @param loglevel Log message level (LOG_DEBUG, LOG_VERBOSE, LOG_DEFAULT, LOG_SPARSE, LOG_NONE) * @param fmt The format of the message to be logged. See your C manual on printf() for details. */ void Log(const std::string &type, int loglevel, const char *fmt, ...) CUSTOM_PRINTF(4, 5); diff --git a/include/modules.h b/include/modules.h index 58062fddd..9ba238da5 100644 --- a/include/modules.h +++ b/include/modules.h @@ -135,7 +135,7 @@ struct ModResult { } \ catch (CoreException& modexcept) \ { \ - ServerInstance->Logs->Log("MODULE",DEFAULT,"Exception caught: %s",modexcept.GetReason()); \ + ServerInstance->Logs->Log("MODULE",LOG_DEFAULT,"Exception caught: %s",modexcept.GetReason()); \ } \ _i = safei; \ } \ @@ -162,7 +162,7 @@ do { \ } \ catch (CoreException& except_ ## n) \ { \ - ServerInstance->Logs->Log("MODULE",DEFAULT,"Exception caught: %s", (except_ ## n).GetReason()); \ + ServerInstance->Logs->Log("MODULE",LOG_DEFAULT,"Exception caught: %s", (except_ ## n).GetReason()); \ (void) mod_ ## n; /* catch mismatched pairs */ \ } \ } \ diff --git a/src/bancache.cpp b/src/bancache.cpp index 2d60bd381..5106e7270 100644 --- a/src/bancache.cpp +++ b/src/bancache.cpp @@ -51,7 +51,7 @@ bool BanCacheManager::RemoveIfExpired(BanCacheHash::iterator& it) if (ServerInstance->Time() < it->second->Expiry) return false; - ServerInstance->Logs->Log("BANCACHE", DEBUG, "Hit on " + it->first + " is out of date, removing!"); + ServerInstance->Logs->Log("BANCACHE", LOG_DEBUG, "Hit on " + it->first + " is out of date, removing!"); delete it->second; it = BanHash->erase(it); return true; @@ -60,9 +60,9 @@ bool BanCacheManager::RemoveIfExpired(BanCacheHash::iterator& it) void BanCacheManager::RemoveEntries(const std::string& type, bool positive) { if (positive) - ServerInstance->Logs->Log("BANCACHE", DEBUG, "BanCacheManager::RemoveEntries(): Removing positive hits for " + type); + ServerInstance->Logs->Log("BANCACHE", LOG_DEBUG, "BanCacheManager::RemoveEntries(): Removing positive hits for " + type); else - ServerInstance->Logs->Log("BANCACHE", DEBUG, "BanCacheManager::RemoveEntries(): Removing all negative hits"); + ServerInstance->Logs->Log("BANCACHE", LOG_DEBUG, "BanCacheManager::RemoveEntries(): Removing all negative hits"); for (BanCacheHash::iterator i = BanHash->begin(); i != BanHash->end(); ) { @@ -86,7 +86,7 @@ void BanCacheManager::RemoveEntries(const std::string& type, bool positive) if (remove) { /* we need to remove this one. */ - ServerInstance->Logs->Log("BANCACHE", DEBUG, "BanCacheManager::RemoveEntries(): Removing a hit on " + i->first); + ServerInstance->Logs->Log("BANCACHE", LOG_DEBUG, "BanCacheManager::RemoveEntries(): Removing a hit on " + i->first); delete b; i = BanHash->erase(i); } diff --git a/src/base.cpp b/src/base.cpp index 66a3cb140..a4c3e887e 100644 --- a/src/base.cpp +++ b/src/base.cpp @@ -28,13 +28,13 @@ classbase::classbase() { if (ServerInstance && ServerInstance->Logs) - ServerInstance->Logs->Log("CULLLIST", DEBUG, "classbase::+ @%p", (void*)this); + ServerInstance->Logs->Log("CULLLIST", LOG_DEBUG, "classbase::+ @%p", (void*)this); } CullResult classbase::cull() { if (ServerInstance && ServerInstance->Logs) - ServerInstance->Logs->Log("CULLLIST", DEBUG, "classbase::-%s @%p", + ServerInstance->Logs->Log("CULLLIST", LOG_DEBUG, "classbase::-%s @%p", typeid(*this).name(), (void*)this); return CullResult(); } @@ -42,7 +42,7 @@ CullResult classbase::cull() classbase::~classbase() { if (ServerInstance && ServerInstance->Logs) - ServerInstance->Logs->Log("CULLLIST", DEBUG, "classbase::~ @%p", (void*)this); + ServerInstance->Logs->Log("CULLLIST", LOG_DEBUG, "classbase::~ @%p", (void*)this); } CullResult::CullResult() @@ -74,14 +74,14 @@ refcountbase::refcountbase() : refcount(0) refcountbase::~refcountbase() { if (refcount && ServerInstance && ServerInstance->Logs) - ServerInstance->Logs->Log("CULLLIST", DEBUG, "refcountbase::~ @%p with refcount %d", + ServerInstance->Logs->Log("CULLLIST", LOG_DEBUG, "refcountbase::~ @%p with refcount %d", (void*)this, refcount); } usecountbase::~usecountbase() { if (usecount && ServerInstance && ServerInstance->Logs) - ServerInstance->Logs->Log("CULLLIST", DEBUG, "usecountbase::~ @%p with refcount %d", + ServerInstance->Logs->Log("CULLLIST", LOG_DEBUG, "usecountbase::~ @%p with refcount %d", (void*)this, usecount); } @@ -198,7 +198,7 @@ CullResult Extensible::cull() Extensible::~Extensible() { if (!extensions.empty() && ServerInstance && ServerInstance->Logs) - ServerInstance->Logs->Log("CULLLIST", DEBUG, + ServerInstance->Logs->Log("CULLLIST", LOG_DEBUG, "Extensible destructor called without cull @%p", (void*)this); } diff --git a/src/channels.cpp b/src/channels.cpp index 0bbb5c56f..7138880ff 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -201,7 +201,7 @@ const UserMembList* Channel::GetUsers() void Channel::SetDefaultModes() { - ServerInstance->Logs->Log("CHANNELS", DEBUG, "SetDefaultModes %s", + ServerInstance->Logs->Log("CHANNELS", LOG_DEBUG, "SetDefaultModes %s", ServerInstance->Config->DefaultModes.c_str()); irc::spacesepstream list(ServerInstance->Config->DefaultModes); std::string modeseq; @@ -280,7 +280,7 @@ Channel* Channel::JoinUser(User* user, std::string cname, bool override, const s if (!IS_LOCAL(user)) { if (!TS) - ServerInstance->Logs->Log("CHANNELS",DEBUG,"*** BUG *** Channel::JoinUser called for REMOTE user '%s' on channel '%s' but no TS given!", user->nick.c_str(), cname.c_str()); + ServerInstance->Logs->Log("CHANNELS",LOG_DEBUG,"*** BUG *** Channel::JoinUser called for REMOTE user '%s' on channel '%s' but no TS given!", user->nick.c_str(), cname.c_str()); } else { @@ -966,7 +966,7 @@ void Invitation::Create(Channel* c, LocalUser* u, time_t timeout) // Expired, don't bother return; - ServerInstance->Logs->Log("INVITATION", DEBUG, "Invitation::Create chan=%s user=%s", c->name.c_str(), u->uuid.c_str()); + ServerInstance->Logs->Log("INVITATION", LOG_DEBUG, "Invitation::Create chan=%s user=%s", c->name.c_str(), u->uuid.c_str()); Invitation* inv = Invitation::Find(c, u, false); if (inv) @@ -974,20 +974,20 @@ void Invitation::Create(Channel* c, LocalUser* u, time_t timeout) if ((inv->expiry == 0) || (inv->expiry > timeout)) return; inv->expiry = timeout; - ServerInstance->Logs->Log("INVITATION", DEBUG, "Invitation::Create changed expiry in existing invitation %p", (void*) inv); + ServerInstance->Logs->Log("INVITATION", LOG_DEBUG, "Invitation::Create changed expiry in existing invitation %p", (void*) inv); } else { inv = new Invitation(c, u, timeout); c->invites.push_back(inv); u->invites.push_back(inv); - ServerInstance->Logs->Log("INVITATION", DEBUG, "Invitation::Create created new invitation %p", (void*) inv); + ServerInstance->Logs->Log("INVITATION", LOG_DEBUG, "Invitation::Create created new invitation %p", (void*) inv); } } Invitation* Invitation::Find(Channel* c, LocalUser* u, bool check_expired) { - ServerInstance->Logs->Log("INVITATION", DEBUG, "Invitation::Find chan=%s user=%s check_expired=%d", c ? c->name.c_str() : "NULL", u ? u->uuid.c_str() : "NULL", check_expired); + ServerInstance->Logs->Log("INVITATION", LOG_DEBUG, "Invitation::Find chan=%s user=%s check_expired=%d", c ? c->name.c_str() : "NULL", u ? u->uuid.c_str() : "NULL", check_expired); if (!u || u->invites.empty()) return NULL; @@ -1002,7 +1002,7 @@ Invitation* Invitation::Find(Channel* c, LocalUser* u, bool check_expired) { /* Expired invite, remove it. */ std::string expiration = ServerInstance->TimeString(inv->expiry); - ServerInstance->Logs->Log("INVITATION", DEBUG, "Invitation::Find ecountered expired entry: %p expired %s", (void*) inv, expiration.c_str()); + ServerInstance->Logs->Log("INVITATION", LOG_DEBUG, "Invitation::Find ecountered expired entry: %p expired %s", (void*) inv, expiration.c_str()); i = locallist.erase(i); inv->cull(); delete inv; @@ -1020,7 +1020,7 @@ Invitation* Invitation::Find(Channel* c, LocalUser* u, bool check_expired) } locallist.swap(u->invites); - ServerInstance->Logs->Log("INVITATION", DEBUG, "Invitation::Find result=%p", (void*) result); + ServerInstance->Logs->Log("INVITATION", LOG_DEBUG, "Invitation::Find result=%p", (void*) result); return result; } @@ -1037,7 +1037,7 @@ Invitation::~Invitation() void InviteBase::ClearInvites() { - ServerInstance->Logs->Log("INVITEBASE", DEBUG, "InviteBase::ClearInvites %p", (void*) this); + ServerInstance->Logs->Log("INVITEBASE", LOG_DEBUG, "InviteBase::ClearInvites %p", (void*) this); InviteList locallist; locallist.swap(invites); for (InviteList::const_iterator i = locallist.begin(); i != locallist.end(); ++i) diff --git a/src/command_parse.cpp b/src/command_parse.cpp index 809d8067b..a7fd810a3 100644 --- a/src/command_parse.cpp +++ b/src/command_parse.cpp @@ -371,7 +371,7 @@ bool CommandParser::ProcessBuffer(std::string &buffer,LocalUser *user) if (!user || buffer.empty()) return true; - ServerInstance->Logs->Log("USERINPUT", RAWIO, "C[%s] I :%s %s", + ServerInstance->Logs->Log("USERINPUT", LOG_RAWIO, "C[%s] I :%s %s", user->uuid.c_str(), user->nick.c_str(), buffer.c_str()); return ProcessCommand(user,buffer); } diff --git a/src/commands.cpp b/src/commands.cpp index d805a1f65..fda1a1734 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -127,7 +127,7 @@ CmdResult SplitCommand::Handle(const std::vector<std::string>& parms, User* u) return HandleRemote(parms, IS_REMOTE(u)); if (IS_SERVER(u)) return HandleServer(parms, IS_SERVER(u)); - ServerInstance->Logs->Log("COMMAND", DEFAULT, "Unknown user type in command (uuid=%s)!", u->uuid.c_str()); + ServerInstance->Logs->Log("COMMAND", LOG_DEFAULT, "Unknown user type in command (uuid=%s)!", u->uuid.c_str()); return CMD_INVALID; } diff --git a/src/commands/cmd_die.cpp b/src/commands/cmd_die.cpp index 1d6640213..06bfa5da5 100644 --- a/src/commands/cmd_die.cpp +++ b/src/commands/cmd_die.cpp @@ -50,7 +50,7 @@ CmdResult CommandDie::Handle (const std::vector<std::string>& parameters, User * { { std::string diebuf = "*** DIE command from " + user->GetFullHost() + ". Terminating."; - ServerInstance->Logs->Log("COMMAND",SPARSE, diebuf); + ServerInstance->Logs->Log("COMMAND",LOG_SPARSE, diebuf); ServerInstance->SendError(diebuf); } @@ -58,7 +58,7 @@ CmdResult CommandDie::Handle (const std::vector<std::string>& parameters, User * } else { - ServerInstance->Logs->Log("COMMAND",SPARSE, "Failed /DIE command from %s", user->GetFullRealHost().c_str()); + ServerInstance->Logs->Log("COMMAND",LOG_SPARSE, "Failed /DIE command from %s", user->GetFullRealHost().c_str()); ServerInstance->SNO->WriteGlobalSno('a', "Failed DIE Command from %s.", user->GetFullRealHost().c_str()); return CMD_FAILURE; } diff --git a/src/commands/cmd_kill.cpp b/src/commands/cmd_kill.cpp index 17c8a76a0..4fa360b15 100644 --- a/src/commands/cmd_kill.cpp +++ b/src/commands/cmd_kill.cpp @@ -125,7 +125,7 @@ CmdResult CommandKill::Handle (const std::vector<std::string>& parameters, User ServerInstance->SNO->WriteGlobalSno('k',"Local Kill by %s: %s (%s)", user->nick.c_str(), u->GetFullRealHost().c_str(), parameters[1].c_str()); else ServerInstance->SNO->WriteToSnoMask('k',"Local Kill by %s: %s (%s)", user->nick.c_str(), u->GetFullRealHost().c_str(), parameters[1].c_str()); - ServerInstance->Logs->Log("KILL",DEFAULT,"LOCAL KILL: %s :%s!%s!%s (%s)", u->nick.c_str(), ServerInstance->Config->ServerName.c_str(), user->dhost.c_str(), user->nick.c_str(), parameters[1].c_str()); + ServerInstance->Logs->Log("KILL",LOG_DEFAULT,"LOCAL KILL: %s :%s!%s!%s (%s)", u->nick.c_str(), ServerInstance->Config->ServerName.c_str(), user->dhost.c_str(), user->nick.c_str(), parameters[1].c_str()); /* 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 4492a385a..117813719 100644 --- a/src/commands/cmd_oper.cpp +++ b/src/commands/cmd_oper.cpp @@ -98,7 +98,7 @@ CmdResult CommandOper::HandleLocal(const std::vector<std::string>& parameters, L user->CommandFloodPenalty += 10000; ServerInstance->SNO->WriteGlobalSno('o', "WARNING! Failed oper attempt by %s using login '%s': The following fields do not match: %s", user->GetFullRealHost().c_str(), parameters[0].c_str(), fields.c_str()); - ServerInstance->Logs->Log("OPER",DEFAULT,"OPER: Failed oper attempt by %s using login '%s': The following fields did not match: %s", user->GetFullRealHost().c_str(), parameters[0].c_str(), fields.c_str()); + ServerInstance->Logs->Log("OPER",LOG_DEFAULT,"OPER: Failed oper attempt by %s using login '%s': The following fields did not match: %s", user->GetFullRealHost().c_str(), parameters[0].c_str(), fields.c_str()); return CMD_FAILURE; } diff --git a/src/commands/cmd_restart.cpp b/src/commands/cmd_restart.cpp index bdbcfed35..174e66063 100644 --- a/src/commands/cmd_restart.cpp +++ b/src/commands/cmd_restart.cpp @@ -39,7 +39,7 @@ class CommandRestart : public Command CmdResult CommandRestart::Handle (const std::vector<std::string>& parameters, User *user) { - ServerInstance->Logs->Log("COMMAND",DEFAULT,"Restart: %s",user->nick.c_str()); + ServerInstance->Logs->Log("COMMAND",LOG_DEFAULT,"Restart: %s",user->nick.c_str()); if (!ServerInstance->PassCompare(user, ServerInstance->Config->restartpass, parameters[0].c_str(), ServerInstance->Config->powerhash)) { ServerInstance->SNO->WriteGlobalSno('a', "RESTART command from %s, restarting server.", user->GetFullRealHost().c_str()); diff --git a/src/commands/cmd_whowas.cpp b/src/commands/cmd_whowas.cpp index 06c4b0509..2779f29ba 100644 --- a/src/commands/cmd_whowas.cpp +++ b/src/commands/cmd_whowas.cpp @@ -183,7 +183,7 @@ void CommandWhowas::PruneWhoWas(time_t t) if (iter == whowas.end()) { /* this should never happen, if it does maps are corrupt */ - ServerInstance->Logs->Log("WHOWAS",DEFAULT, "BUG: Whowas maps got corrupted! (1)"); + ServerInstance->Logs->Log("WHOWAS",LOG_DEFAULT, "BUG: Whowas maps got corrupted! (1)"); return; } @@ -216,7 +216,7 @@ void CommandWhowas::PruneWhoWas(time_t t) if (iter == whowas.end()) { /* this should never happen, if it does maps are corrupt */ - ServerInstance->Logs->Log("WHOWAS",DEFAULT, "BUG: Whowas maps got corrupted! (2)"); + ServerInstance->Logs->Log("WHOWAS",LOG_DEFAULT, "BUG: Whowas maps got corrupted! (2)"); return; } whowas_set* n = (whowas_set*)iter->second; @@ -264,7 +264,7 @@ CommandWhowas::~CommandWhowas() if (iter == whowas.end()) { /* this should never happen, if it does maps are corrupt */ - ServerInstance->Logs->Log("WHOWAS",DEFAULT, "BUG: Whowas maps got corrupted! (3)"); + ServerInstance->Logs->Log("WHOWAS",LOG_DEFAULT, "BUG: Whowas maps got corrupted! (3)"); return; } @@ -305,7 +305,7 @@ class ModuleWhoWas : public Module if (value >= min && value <= max) return; - ServerInstance->Logs->Log("CONFIG", DEFAULT, "WARNING: %s value of %d is not between %d and %d; set to %d.", msg, value, min, max, def); + ServerInstance->Logs->Log("CONFIG", LOG_DEFAULT, "WARNING: %s value of %d is not between %d and %d; set to %d.", msg, value, min, max, def); value = def; } diff --git a/src/configparser.cpp b/src/configparser.cpp index 25b919b81..ec6a6c8e5 100644 --- a/src/configparser.cpp +++ b/src/configparser.cpp @@ -342,7 +342,7 @@ void ParseStack::DoReadFile(const std::string& key, const std::string& name, int bool ParseStack::ParseFile(const std::string& name, int flags, const std::string& mandatory_tag) { - ServerInstance->Logs->Log("CONFIG", DEBUG, "Reading file %s", name.c_str()); + ServerInstance->Logs->Log("CONFIG", LOG_DEBUG, "Reading file %s", name.c_str()); for (unsigned int t = 0; t < reading.size(); t++) { if (std::string(name) == reading[t]) @@ -366,7 +366,7 @@ bool ParseStack::ParseFile(const std::string& name, int flags, const std::string bool ParseStack::ParseExec(const std::string& name, int flags, const std::string& mandatory_tag) { - ServerInstance->Logs->Log("CONFIG", DEBUG, "Reading executable %s", name.c_str()); + ServerInstance->Logs->Log("CONFIG", LOG_DEBUG, "Reading executable %s", name.c_str()); for (unsigned int t = 0; t < reading.size(); t++) { if (std::string(name) == reading[t]) @@ -399,7 +399,7 @@ bool ConfigTag::readString(const std::string& key, std::string& value, bool allo value = j->second; if (!allow_lf && (value.find('\n') != std::string::npos)) { - ServerInstance->Logs->Log("CONFIG",DEFAULT, "Value of <" + tag + ":" + key + "> at " + getTagLocation() + + ServerInstance->Logs->Log("CONFIG",LOG_DEFAULT, "Value of <" + tag + ":" + key + "> at " + getTagLocation() + " contains a linefeed, and linefeeds in this value are not permitted -- stripped to spaces."); for (std::string::iterator n = value.begin(); n != value.end(); n++) if (*n == '\n') @@ -462,7 +462,7 @@ bool ConfigTag::getBool(const std::string &key, bool def) if (result == "no" || result == "false" || result == "0" || result == "off") return false; - ServerInstance->Logs->Log("CONFIG",DEFAULT, "Value of <" + tag + ":" + key + "> at " + getTagLocation() + + ServerInstance->Logs->Log("CONFIG",LOG_DEFAULT, "Value of <" + tag + ":" + key + "> at " + getTagLocation() + " is not valid, ignoring"); return def; } diff --git a/src/configreader.cpp b/src/configreader.cpp index 2906d66b9..70e8cea78 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -54,7 +54,7 @@ static void range(T& value, V min, V max, V def, const char* msg) { if (value >= (T)min && value <= (T)max) return; - ServerInstance->Logs->Log("CONFIG", DEFAULT, + ServerInstance->Logs->Log("CONFIG", LOG_DEFAULT, "WARNING: %s value of %ld is not between %ld and %ld; set to %ld.", msg, (long)value, (long)min, (long)max, (long)def); value = def; @@ -115,7 +115,7 @@ static void FindDNS(std::string& server) return; #ifdef _WIN32 // attempt to look up their nameserver from the system - ServerInstance->Logs->Log("CONFIG",DEFAULT,"WARNING: <dns:server> not defined, attempting to find a working server in the system settings..."); + ServerInstance->Logs->Log("CONFIG",LOG_DEFAULT,"WARNING: <dns:server> not defined, attempting to find a working server in the system settings..."); PFIXED_INFO pFixedInfo; DWORD dwBufferSize = sizeof(FIXED_INFO); @@ -137,15 +137,15 @@ static void FindDNS(std::string& server) if(!server.empty()) { - ServerInstance->Logs->Log("CONFIG",DEFAULT,"<dns:server> set to '%s' as first active resolver in the system settings.", server.c_str()); + ServerInstance->Logs->Log("CONFIG",LOG_DEFAULT,"<dns:server> set to '%s' as first active resolver in the system settings.", server.c_str()); return; } } - ServerInstance->Logs->Log("CONFIG",DEFAULT,"No viable nameserver found! Defaulting to nameserver '127.0.0.1'!"); + ServerInstance->Logs->Log("CONFIG",LOG_DEFAULT,"No viable nameserver found! Defaulting to nameserver '127.0.0.1'!"); #else // attempt to look up their nameserver from /etc/resolv.conf - ServerInstance->Logs->Log("CONFIG",DEFAULT,"WARNING: <dns:server> not defined, attempting to find working server in /etc/resolv.conf..."); + ServerInstance->Logs->Log("CONFIG",LOG_DEFAULT,"WARNING: <dns:server> not defined, attempting to find working server in /etc/resolv.conf..."); std::ifstream resolv("/etc/resolv.conf"); @@ -156,13 +156,13 @@ static void FindDNS(std::string& server) resolv >> server; if (server.find_first_not_of("0123456789.") == std::string::npos) { - ServerInstance->Logs->Log("CONFIG",DEFAULT,"<dns:server> set to '%s' as first resolver in /etc/resolv.conf.",server.c_str()); + ServerInstance->Logs->Log("CONFIG",LOG_DEFAULT,"<dns:server> set to '%s' as first resolver in /etc/resolv.conf.",server.c_str()); return; } } } - ServerInstance->Logs->Log("CONFIG",DEFAULT,"/etc/resolv.conf contains no viable nameserver entries! Defaulting to nameserver '127.0.0.1'!"); + ServerInstance->Logs->Log("CONFIG",LOG_DEFAULT,"/etc/resolv.conf contains no viable nameserver entries! Defaulting to nameserver '127.0.0.1'!"); #endif server = "127.0.0.1"; } @@ -685,7 +685,7 @@ void ServerConfig::Apply(ServerConfig* old, const std::string &useruid) User* user = useruid.empty() ? NULL : ServerInstance->FindNick(useruid); if (!valid) - ServerInstance->Logs->Log("CONFIG",DEFAULT, "There were errors in your configuration file:"); + ServerInstance->Logs->Log("CONFIG",LOG_DEFAULT, "There were errors in your configuration file:"); while (errstr.good()) { @@ -827,7 +827,7 @@ ConfigTag* ServerConfig::ConfValue(const std::string &tag) ConfigTag* rv = found.first->second; found.first++; if (found.first != found.second) - ServerInstance->Logs->Log("CONFIG",DEFAULT, "Multiple <" + tag + "> tags found; only first will be used " + ServerInstance->Logs->Log("CONFIG",LOG_DEFAULT, "Multiple <" + tag + "> tags found; only first will be used " "(first at " + rv->getTagLocation() + "; second at " + found.first->second->getTagLocation() + ")"); return rv; } @@ -877,7 +877,7 @@ void ConfigReaderThread::Run() void ConfigReaderThread::Finish() { ServerConfig* old = ServerInstance->Config; - ServerInstance->Logs->Log("CONFIG",DEBUG,"Switching to new configuration..."); + ServerInstance->Logs->Log("CONFIG",LOG_DEBUG,"Switching to new configuration..."); ServerInstance->Config = this->Config; Config->Apply(old, TheUserUID); diff --git a/src/cull_list.cpp b/src/cull_list.cpp index 956ed3494..5bb23b878 100644 --- a/src/cull_list.cpp +++ b/src/cull_list.cpp @@ -46,14 +46,14 @@ void CullList::Apply() classbase* c = list[i]; if (gone.insert(c).second) { - ServerInstance->Logs->Log("CULLLIST", DEBUG, "Deleting %s @%p", typeid(*c).name(), + ServerInstance->Logs->Log("CULLLIST", LOG_DEBUG, "Deleting %s @%p", typeid(*c).name(), (void*)c); c->cull(); queue.push_back(c); } else { - ServerInstance->Logs->Log("CULLLIST",DEBUG, "WARNING: Object @%p culled twice!", + ServerInstance->Logs->Log("CULLLIST",LOG_DEBUG, "WARNING: Object @%p culled twice!", (void*)c); } } @@ -65,7 +65,7 @@ void CullList::Apply() } if (list.size()) { - ServerInstance->Logs->Log("CULLLIST",DEBUG, "WARNING: Objects added to cull list in a destructor"); + ServerInstance->Logs->Log("CULLLIST",LOG_DEBUG, "WARNING: Objects added to cull list in a destructor"); Apply(); } } diff --git a/src/dns.cpp b/src/dns.cpp index 63bde0ecc..461722b29 100644 --- a/src/dns.cpp +++ b/src/dns.cpp @@ -234,7 +234,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->Logs->Log("RESOLVER", DEBUG,"DNSRequest::SendRequests"); + ServerInstance->Logs->Log("RESOLVER", LOG_DEBUG,"DNSRequest::SendRequests"); unsigned char payload[sizeof(DNSHeader)]; @@ -246,7 +246,7 @@ int DNSRequest::SendRequests(const DNSHeader *header, const int length, QueryTyp if (ServerInstance->SE->SendTo(dnsobj, payload, length + 12, 0, &(dnsobj->myserver.sa), sa_size(dnsobj->myserver)) != length+12) return -1; - ServerInstance->Logs->Log("RESOLVER",DEBUG,"Sent OK"); + ServerInstance->Logs->Log("RESOLVER",LOG_DEBUG,"Sent OK"); return 0; } @@ -362,14 +362,14 @@ void DNS::Rehash() if (ServerInstance->SE->Bind(this->GetFd(), bindto) < 0) { /* Failed to bind */ - ServerInstance->Logs->Log("RESOLVER",SPARSE,"Error binding dns socket - hostnames will NOT resolve"); + ServerInstance->Logs->Log("RESOLVER",LOG_SPARSE,"Error binding dns socket - hostnames will NOT resolve"); ServerInstance->SE->Shutdown(this, 2); ServerInstance->SE->Close(this); this->SetFd(-1); } else if (!ServerInstance->SE->AddFd(this, FD_WANT_POLL_READ | FD_WANT_NO_WRITE)) { - ServerInstance->Logs->Log("RESOLVER",SPARSE,"Internal error starting DNS - hostnames will NOT resolve."); + ServerInstance->Logs->Log("RESOLVER",LOG_SPARSE,"Internal error starting DNS - hostnames will NOT resolve."); ServerInstance->SE->Shutdown(this, 2); ServerInstance->SE->Close(this); this->SetFd(-1); @@ -377,14 +377,14 @@ void DNS::Rehash() } else { - ServerInstance->Logs->Log("RESOLVER",SPARSE,"Error creating DNS socket - hostnames will NOT resolve"); + ServerInstance->Logs->Log("RESOLVER",LOG_SPARSE,"Error creating DNS socket - hostnames will NOT resolve"); } } /** Initialise the DNS UDP socket so that we can send requests */ DNS::DNS() { - ServerInstance->Logs->Log("RESOLVER",DEBUG,"DNS::DNS"); + ServerInstance->Logs->Log("RESOLVER",LOG_DEBUG,"DNS::DNS"); /* Clear the Resolver class table */ memset(Classes,0,sizeof(Classes)); @@ -517,7 +517,7 @@ int DNS::GetNameForce(const char *ip, ForceProtocol fp) } else { - ServerInstance->Logs->Log("RESOLVER",DEBUG,"DNS::GetNameForce IPv6 bad format for '%s'", ip); + ServerInstance->Logs->Log("RESOLVER",LOG_DEBUG,"DNS::GetNameForce IPv6 bad format for '%s'", ip); /* Invalid IP address */ return -1; } @@ -532,7 +532,7 @@ int DNS::GetNameForce(const char *ip, ForceProtocol fp) } else { - ServerInstance->Logs->Log("RESOLVER",DEBUG,"DNS::GetNameForce IPv4 bad format for '%s'", ip); + ServerInstance->Logs->Log("RESOLVER",LOG_DEBUG,"DNS::GetNameForce IPv4 bad format for '%s'", ip); /* Invalid IP address */ return -1; } @@ -541,7 +541,7 @@ int DNS::GetNameForce(const char *ip, ForceProtocol fp) length = this->MakePayload(query, DNS_QUERY_PTR, 1, (unsigned char*)&h.payload); if (length == -1) { - ServerInstance->Logs->Log("RESOLVER",DEBUG,"DNS::GetNameForce can't query '%s' using '%s' because it's too long", ip, query); + ServerInstance->Logs->Log("RESOLVER",LOG_DEBUG,"DNS::GetNameForce can't query '%s' using '%s' because it's too long", ip, query); return -1; } @@ -549,13 +549,13 @@ int DNS::GetNameForce(const char *ip, ForceProtocol fp) if (!req) { - ServerInstance->Logs->Log("RESOLVER",DEBUG,"DNS::GetNameForce can't add query (resolver down?)"); + ServerInstance->Logs->Log("RESOLVER",LOG_DEBUG,"DNS::GetNameForce can't add query (resolver down?)"); return -1; } if (req->SendRequests(&h, length, DNS_QUERY_PTR) == -1) { - ServerInstance->Logs->Log("RESOLVER",DEBUG,"DNS::GetNameForce can't send (firewall?)"); + ServerInstance->Logs->Log("RESOLVER",LOG_DEBUG,"DNS::GetNameForce can't send (firewall?)"); return -1; } @@ -596,7 +596,7 @@ DNSResult DNS::GetResult() /* Did we get the whole header? */ if (length < 12) { - ServerInstance->Logs->Log("RESOLVER",DEBUG,"GetResult didn't get a full packet (len=%d)", length); + ServerInstance->Logs->Log("RESOLVER",LOG_DEBUG,"GetResult didn't get a full packet (len=%d)", length); /* Nope - something screwed up. */ return DNSResult(-1,"",0,""); } @@ -614,7 +614,7 @@ DNSResult DNS::GetResult() { std::string server1 = from.str(); std::string server2 = myserver.str(); - ServerInstance->Logs->Log("RESOLVER",DEBUG,"Got a result from the wrong server! Bad NAT or DNS forging attempt? '%s' != '%s'", + ServerInstance->Logs->Log("RESOLVER",LOG_DEBUG,"Got a result from the wrong server! Bad NAT or DNS forging attempt? '%s' != '%s'", server1.c_str(), server2.c_str()); return DNSResult(-1,"",0,""); } @@ -632,7 +632,7 @@ DNSResult DNS::GetResult() if (!requests[this_id]) { /* Somehow we got a DNS response for a request we never made... */ - ServerInstance->Logs->Log("RESOLVER",DEBUG,"Hmm, got a result that we didn't ask for (id=%lx). Ignoring.", this_id); + ServerInstance->Logs->Log("RESOLVER",LOG_DEBUG,"Hmm, got a result that we didn't ask for (id=%lx). Ignoring.", this_id); return DNSResult(-1,"",0,""); } else @@ -796,7 +796,7 @@ DNSInfo DNSRequest::ResultIsReady(DNSHeader &header, unsigned length) DNS::FillResourceRecord(&rr,&header.payload[i]); i += 10; - ServerInstance->Logs->Log("RESOLVER",DEBUG,"Resolver: rr.type is %d and this.type is %d rr.class %d this.class %d", rr.type, this->type, rr.rr_class, this->rr_class); + ServerInstance->Logs->Log("RESOLVER",LOG_DEBUG,"Resolver: rr.type is %d and this.type is %d rr.class %d this.class %d", rr.type, this->type, rr.rr_class, this->rr_class); if (rr.type != this->type) { curanswer++; @@ -934,7 +934,7 @@ void Resolver::TriggerCachedResult() /** High level abstraction of dns used by application at large */ Resolver::Resolver(const std::string &source, QueryType qt, bool &cached, Module* creator) : Creator(creator), input(source), querytype(qt) { - ServerInstance->Logs->Log("RESOLVER",DEBUG,"Resolver::Resolver"); + ServerInstance->Logs->Log("RESOLVER",LOG_DEBUG,"Resolver::Resolver"); cached = false; CQ = ServerInstance->Res->GetCache(source); @@ -977,7 +977,7 @@ Resolver::Resolver(const std::string &source, QueryType qt, bool &cached, Module break; default: - ServerInstance->Logs->Log("RESOLVER",DEBUG,"DNS request with unknown query type %d", querytype); + ServerInstance->Logs->Log("RESOLVER",LOG_DEBUG,"DNS request with unknown query type %d", querytype); this->myid = -1; break; } @@ -987,7 +987,7 @@ Resolver::Resolver(const std::string &source, QueryType qt, bool &cached, Module } else { - ServerInstance->Logs->Log("RESOLVER",DEBUG,"DNS request id %d", this->myid); + ServerInstance->Logs->Log("RESOLVER",LOG_DEBUG,"DNS request id %d", this->myid); } } @@ -1020,11 +1020,11 @@ void DNS::HandleEvent(EventType, int) /* Fetch the id and result of the next available packet */ DNSResult res(0,"",0,""); res.id = 0; - ServerInstance->Logs->Log("RESOLVER",DEBUG,"Handle DNS event"); + ServerInstance->Logs->Log("RESOLVER",LOG_DEBUG,"Handle DNS event"); res = this->GetResult(); - ServerInstance->Logs->Log("RESOLVER",DEBUG,"Result id %d", res.id); + ServerInstance->Logs->Log("RESOLVER",LOG_DEBUG,"Result id %d", res.id); /* Is there a usable request id? */ if (res.id != -1) @@ -1070,7 +1070,7 @@ void DNS::HandleEvent(EventType, int) /** Add a derived Resolver to the working set */ bool DNS::AddResolverClass(Resolver* r) { - ServerInstance->Logs->Log("RESOLVER",DEBUG,"AddResolverClass 0x%08lx", (unsigned long)r); + ServerInstance->Logs->Log("RESOLVER",LOG_DEBUG,"AddResolverClass 0x%08lx", (unsigned long)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 ee059e756..fba76805c 100644 --- a/src/helperfuncs.cpp +++ b/src/helperfuncs.cpp @@ -379,7 +379,7 @@ bool InspIRCd::OpenLog(char**, int) } FileWriter* fw = new FileWriter(startup); - FileLogStream *f = new FileLogStream((Config->cmdline.forcedebug ? DEBUG : DEFAULT), fw); + FileLogStream *f = new FileLogStream((Config->cmdline.forcedebug ? LOG_DEBUG : LOG_DEFAULT), fw); this->Logs->AddLogType("*", f, true); @@ -392,7 +392,7 @@ void InspIRCd::CheckRoot() if (geteuid() == 0) { std::cout << "ERROR: You are running an irc server as root! DO NOT DO THIS!" << std::endl << std::endl; - this->Logs->Log("STARTUP",DEFAULT,"Can't start as root"); + this->Logs->Log("STARTUP",LOG_DEFAULT,"Can't start as root"); Exit(EXIT_STATUS_ROOT); } #endif diff --git a/src/inspircd.cpp b/src/inspircd.cpp index e02c42a82..bd1562473 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -234,13 +234,13 @@ bool InspIRCd::DaemonSeed() rlimit rl; if (getrlimit(RLIMIT_CORE, &rl) == -1) { - this->Logs->Log("STARTUP",DEFAULT,"Failed to getrlimit()!"); + this->Logs->Log("STARTUP",LOG_DEFAULT,"Failed to getrlimit()!"); return false; } rl.rlim_cur = rl.rlim_max; if (setrlimit(RLIMIT_CORE, &rl) == -1) - this->Logs->Log("STARTUP",DEFAULT,"setrlimit() failed, cannot increase coredump size."); + this->Logs->Log("STARTUP",LOG_DEFAULT,"setrlimit() failed, cannot increase coredump size."); return true; #endif @@ -261,7 +261,7 @@ void InspIRCd::WritePID(const std::string &filename) else { std::cout << "Failed to write PID-file '" << fname << "', exiting." << std::endl; - this->Logs->Log("STARTUP",DEFAULT,"Failed to write PID-file '%s', exiting.",fname.c_str()); + this->Logs->Log("STARTUP",LOG_DEFAULT,"Failed to write PID-file '%s', exiting.",fname.c_str()); Exit(EXIT_STATUS_PID); } #endif @@ -435,7 +435,7 @@ InspIRCd::InspIRCd(int argc, char** argv) : if (do_debug) { FileWriter* fw = new FileWriter(stdout); - FileLogStream* fls = new FileLogStream(RAWIO, fw); + FileLogStream* fls = new FileLogStream(LOG_RAWIO, fw); Logs->AddLogTypes("*", fls, true); } else if (!this->OpenLog(argv, argc)) @@ -459,7 +459,7 @@ InspIRCd::InspIRCd(int argc, char** argv) : #endif { std::cout << "ERROR: Cannot open config file: " << ConfigFileName << std::endl << "Exiting..." << std::endl; - this->Logs->Log("STARTUP",DEFAULT,"Unable to open config file %s", ConfigFileName.c_str()); + this->Logs->Log("STARTUP",LOG_DEFAULT,"Unable to open config file %s", ConfigFileName.c_str()); Exit(EXIT_STATUS_CONFIG); } } @@ -497,7 +497,7 @@ InspIRCd::InspIRCd(int argc, char** argv) : if (!this->DaemonSeed()) { std::cout << "ERROR: could not go into daemon mode. Shutting down." << std::endl; - Logs->Log("STARTUP", DEFAULT, "ERROR: could not go into daemon mode. Shutting down."); + Logs->Log("STARTUP", LOG_DEFAULT, "ERROR: could not go into daemon mode. Shutting down."); Exit(EXIT_STATUS_FORK); } } @@ -573,7 +573,7 @@ InspIRCd::InspIRCd(int argc, char** argv) : if (kill(getppid(), SIGTERM) == -1) { std::cout << "Error killing parent process: " << strerror(errno) << std::endl; - Logs->Log("STARTUP", DEFAULT, "Error killing parent process: %s",strerror(errno)); + Logs->Log("STARTUP", LOG_DEFAULT, "Error killing parent process: %s",strerror(errno)); } } @@ -596,16 +596,16 @@ InspIRCd::InspIRCd(int argc, char** argv) : fclose(stdout); if (dup2(fd, STDIN_FILENO) < 0) - Logs->Log("STARTUP", DEFAULT, "Failed to dup /dev/null to stdin."); + Logs->Log("STARTUP", LOG_DEFAULT, "Failed to dup /dev/null to stdin."); if (dup2(fd, STDOUT_FILENO) < 0) - Logs->Log("STARTUP", DEFAULT, "Failed to dup /dev/null to stdout."); + Logs->Log("STARTUP", LOG_DEFAULT, "Failed to dup /dev/null to stdout."); if (dup2(fd, STDERR_FILENO) < 0) - Logs->Log("STARTUP", DEFAULT, "Failed to dup /dev/null to stderr."); + Logs->Log("STARTUP", LOG_DEFAULT, "Failed to dup /dev/null to stderr."); close(fd); } else { - Logs->Log("STARTUP", DEFAULT,"Keeping pseudo-tty open as we are running in the foreground."); + Logs->Log("STARTUP", LOG_DEFAULT,"Keeping pseudo-tty open as we are running in the foreground."); } #else /* Set win32 service as running, if we are running as a service */ @@ -620,7 +620,7 @@ InspIRCd::InspIRCd(int argc, char** argv) : QueryPerformanceFrequency(&stats->QPFrequency); #endif - Logs->Log("STARTUP", DEFAULT, "Startup complete as '%s'[%s], %d max open sockets", Config->ServerName.c_str(),Config->GetSID().c_str(), SE->GetMaxFds()); + Logs->Log("STARTUP", LOG_DEFAULT, "Startup complete as '%s'[%s], %d max open sockets", Config->ServerName.c_str(),Config->GetSID().c_str(), SE->GetMaxFds()); #ifndef _WIN32 std::string SetUser = Config->ConfValue("security")->getString("runasuser"); @@ -634,7 +634,7 @@ InspIRCd::InspIRCd(int argc, char** argv) : if (ret == -1) { - this->Logs->Log("SETGROUPS", DEFAULT, "setgroups() failed (wtf?): %s", strerror(errno)); + this->Logs->Log("SETGROUPS", LOG_DEFAULT, "setgroups() failed (wtf?): %s", strerror(errno)); this->QuickExit(0); } @@ -646,7 +646,7 @@ InspIRCd::InspIRCd(int argc, char** argv) : if (!g) { - this->Logs->Log("SETGUID", DEFAULT, "getgrnam() failed (bad user?): %s", strerror(errno)); + this->Logs->Log("SETGUID", LOG_DEFAULT, "getgrnam() failed (bad user?): %s", strerror(errno)); this->QuickExit(0); } @@ -654,7 +654,7 @@ InspIRCd::InspIRCd(int argc, char** argv) : if (ret == -1) { - this->Logs->Log("SETGUID", DEFAULT, "setgid() failed (bad user?): %s", strerror(errno)); + this->Logs->Log("SETGUID", LOG_DEFAULT, "setgid() failed (bad user?): %s", strerror(errno)); this->QuickExit(0); } } @@ -669,7 +669,7 @@ InspIRCd::InspIRCd(int argc, char** argv) : if (!u) { - this->Logs->Log("SETGUID", DEFAULT, "getpwnam() failed (bad user?): %s", strerror(errno)); + this->Logs->Log("SETGUID", LOG_DEFAULT, "getpwnam() failed (bad user?): %s", strerror(errno)); this->QuickExit(0); } @@ -677,7 +677,7 @@ InspIRCd::InspIRCd(int argc, char** argv) : if (ret == -1) { - this->Logs->Log("SETGUID", DEFAULT, "setuid() failed (bad user?): %s", strerror(errno)); + this->Logs->Log("SETGUID", LOG_DEFAULT, "setuid() failed (bad user?): %s", strerror(errno)); this->QuickExit(0); } } @@ -729,7 +729,7 @@ int InspIRCd::Run() if (this->ConfigThread && this->ConfigThread->IsDone()) { /* Rehash has completed */ - this->Logs->Log("CONFIG",DEBUG,"Detected ConfigThread exiting, tidying up..."); + this->Logs->Log("CONFIG",LOG_DEBUG,"Detected ConfigThread exiting, tidying up..."); this->ConfigThread->Finish(); diff --git a/src/inspsocket.cpp b/src/inspsocket.cpp index 27c6f87ec..fdd002ad6 100644 --- a/src/inspsocket.cpp +++ b/src/inspsocket.cpp @@ -66,7 +66,7 @@ BufferedSocketError BufferedSocket::BeginConnect(const std::string &ipaddr, int irc::sockets::sockaddrs addr, bind; if (!irc::sockets::aptosa(ipaddr, aport, addr)) { - ServerInstance->Logs->Log("SOCKET", DEBUG, "BUG: Hostname passed to BufferedSocket, rather than an IP address!"); + ServerInstance->Logs->Log("SOCKET", LOG_DEBUG, "BUG: Hostname passed to BufferedSocket, rather than an IP address!"); return I_ERR_CONNECT; } @@ -112,7 +112,7 @@ BufferedSocketError BufferedSocket::BeginConnect(const irc::sockets::sockaddrs& this->Timeout = new SocketTimeout(this->GetFd(), this, timeout, ServerInstance->Time()); ServerInstance->Timers->AddTimer(this->Timeout); - ServerInstance->Logs->Log("SOCKET", DEBUG,"BufferedSocket::DoConnect success"); + ServerInstance->Logs->Log("SOCKET", LOG_DEBUG,"BufferedSocket::DoConnect success"); return I_ERR_NONE; } @@ -130,7 +130,7 @@ void StreamSocket::Close() } catch (CoreException& modexcept) { - ServerInstance->Logs->Log("SOCKET", DEFAULT,"%s threw an exception: %s", + ServerInstance->Logs->Log("SOCKET", LOG_DEFAULT,"%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason()); } IOHook = NULL; @@ -170,7 +170,7 @@ void StreamSocket::DoRead() } catch (CoreException& modexcept) { - ServerInstance->Logs->Log("SOCKET", DEFAULT, "%s threw an exception: %s", + ServerInstance->Logs->Log("SOCKET", LOG_DEFAULT, "%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason()); return; } @@ -225,7 +225,7 @@ void StreamSocket::DoWrite() return; if (!error.empty() || fd < 0 || fd == INT_MAX) { - ServerInstance->Logs->Log("SOCKET", DEBUG, "DoWrite on errored or closed socket"); + ServerInstance->Logs->Log("SOCKET", LOG_DEBUG, "DoWrite on errored or closed socket"); return; } @@ -317,7 +317,7 @@ void StreamSocket::DoWrite() } catch (CoreException& modexcept) { - ServerInstance->Logs->Log("SOCKET", DEBUG,"%s threw an exception: %s", + ServerInstance->Logs->Log("SOCKET", LOG_DEBUG,"%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason()); } } @@ -419,7 +419,7 @@ void StreamSocket::WriteData(const std::string &data) { if (fd < 0) { - ServerInstance->Logs->Log("SOCKET", DEBUG, "Attempt to write data to dead socket: %s", + ServerInstance->Logs->Log("SOCKET", LOG_DEBUG, "Attempt to write data to dead socket: %s", data.c_str()); return; } @@ -433,7 +433,7 @@ void StreamSocket::WriteData(const std::string &data) void SocketTimeout::Tick(time_t) { - ServerInstance->Logs->Log("SOCKET", DEBUG,"SocketTimeout::Tick"); + ServerInstance->Logs->Log("SOCKET", LOG_DEBUG,"SocketTimeout::Tick"); if (ServerInstance->SE->GetRef(this->sfd) != this->sock) return; @@ -528,13 +528,13 @@ void StreamSocket::HandleEvent(EventType et, int errornum) } catch (CoreException& ex) { - ServerInstance->Logs->Log("SOCKET", DEFAULT, "Caught exception in socket processing on FD %d - '%s'", + ServerInstance->Logs->Log("SOCKET", LOG_DEFAULT, "Caught exception in socket processing on FD %d - '%s'", fd, ex.GetReason()); SetError(ex.GetReason()); } if (!error.empty()) { - ServerInstance->Logs->Log("SOCKET", DEBUG, "Error on FD %d - '%s'", fd, error.c_str()); + ServerInstance->Logs->Log("SOCKET", LOG_DEBUG, "Error on FD %d - '%s'", fd, error.c_str()); OnError(errcode); } } diff --git a/src/listensocket.cpp b/src/listensocket.cpp index 3a4473697..2f25c5493 100644 --- a/src/listensocket.cpp +++ b/src/listensocket.cpp @@ -74,9 +74,9 @@ ListenSocket::~ListenSocket() if (this->GetFd() > -1) { ServerInstance->SE->DelFd(this); - ServerInstance->Logs->Log("SOCKET", DEBUG,"Shut down listener on fd %d", this->fd); + ServerInstance->Logs->Log("SOCKET", LOG_DEBUG,"Shut down listener on fd %d", this->fd); if (ServerInstance->SE->Shutdown(this, 2) || ServerInstance->SE->Close(this)) - ServerInstance->Logs->Log("SOCKET", DEBUG,"Failed to cancel listener: %s", strerror(errno)); + ServerInstance->Logs->Log("SOCKET", LOG_DEBUG,"Failed to cancel listener: %s", strerror(errno)); this->fd = -1; } } @@ -90,7 +90,7 @@ void ListenSocket::AcceptInternal() socklen_t length = sizeof(client); int incomingSockfd = ServerInstance->SE->Accept(this, &client.sa, &length); - ServerInstance->Logs->Log("SOCKET",DEBUG,"HandleEvent for Listensocket %s nfd=%d", bind_desc.c_str(), incomingSockfd); + ServerInstance->Logs->Log("SOCKET",LOG_DEBUG,"HandleEvent for Listensocket %s nfd=%d", bind_desc.c_str(), incomingSockfd); if (incomingSockfd < 0) { ServerInstance->stats->statsRefused++; @@ -100,7 +100,7 @@ void ListenSocket::AcceptInternal() socklen_t sz = sizeof(server); if (getsockname(incomingSockfd, &server.sa, &sz)) { - ServerInstance->Logs->Log("SOCKET", DEBUG, "Can't get peername: %s", strerror(errno)); + ServerInstance->Logs->Log("SOCKET", LOG_DEBUG, "Can't get peername: %s", strerror(errno)); irc::sockets::aptosa(bind_addr, bind_port, server); } @@ -116,7 +116,7 @@ void ListenSocket::AcceptInternal() */ if (incomingSockfd >= ServerInstance->SE->GetMaxFds()) { - ServerInstance->Logs->Log("SOCKET", DEBUG, "Server is full"); + ServerInstance->Logs->Log("SOCKET", LOG_DEBUG, "Server is full"); ServerInstance->SE->Shutdown(incomingSockfd, 2); ServerInstance->SE->Close(incomingSockfd); ServerInstance->stats->statsRefused++; @@ -173,7 +173,7 @@ void ListenSocket::AcceptInternal() else { ServerInstance->stats->statsRefused++; - ServerInstance->Logs->Log("SOCKET",DEFAULT,"Refusing connection on %s - %s", + ServerInstance->Logs->Log("SOCKET",LOG_DEFAULT,"Refusing connection on %s - %s", bind_desc.c_str(), res == MOD_RES_DENY ? "Connection refused by module" : "Module for this port not found"); ServerInstance->SE->Close(incomingSockfd); } @@ -184,10 +184,10 @@ void ListenSocket::HandleEvent(EventType e, int err) switch (e) { case EVENT_ERROR: - ServerInstance->Logs->Log("SOCKET",DEFAULT,"ListenSocket::HandleEvent() received a socket engine error event! well shit! '%s'", strerror(err)); + ServerInstance->Logs->Log("SOCKET",LOG_DEFAULT,"ListenSocket::HandleEvent() received a socket engine error event! well shit! '%s'", strerror(err)); break; case EVENT_WRITE: - ServerInstance->Logs->Log("SOCKET",DEBUG,"*** BUG *** ListenSocket::HandleEvent() got a WRITE event!!!"); + ServerInstance->Logs->Log("SOCKET",LOG_DEBUG,"*** BUG *** ListenSocket::HandleEvent() got a WRITE event!!!"); break; case EVENT_READ: this->AcceptInternal(); diff --git a/src/logger.cpp b/src/logger.cpp index 89b2be019..b33f65ac4 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -82,31 +82,31 @@ void LogManager::OpenFileLogs() } std::string type = tag->getString("type"); std::string level = tag->getString("level"); - int loglevel = DEFAULT; + int loglevel = LOG_DEFAULT; if (level == "rawio") { - loglevel = RAWIO; + loglevel = LOG_RAWIO; ServerInstance->Config->RawLog = true; } else if (level == "debug") { - loglevel = DEBUG; + loglevel = LOG_DEBUG; } else if (level == "verbose") { - loglevel = VERBOSE; + loglevel = LOG_VERBOSE; } else if (level == "default") { - loglevel = DEFAULT; + loglevel = LOG_DEFAULT; } else if (level == "sparse") { - loglevel = SPARSE; + loglevel = LOG_SPARSE; } else if (level == "none") { - loglevel = NONE; + loglevel = LOG_NONE; } FileWriter* fw; std::string target = tag->getString("target"); @@ -126,7 +126,7 @@ void LogManager::OpenFileLogs() fw = fwi->second; } FileLogStream* fls = new FileLogStream(loglevel, fw); - fls->OnLog(SPARSE, "HEADER", InspIRCd::LogHeader); + fls->OnLog(LOG_SPARSE, "HEADER", InspIRCd::LogHeader); AddLogTypes(type, fls, true); } } diff --git a/src/modmanager_dynamic.cpp b/src/modmanager_dynamic.cpp index 49c91a7d8..adff8630d 100644 --- a/src/modmanager_dynamic.cpp +++ b/src/modmanager_dynamic.cpp @@ -44,14 +44,14 @@ bool ModuleManager::Load(const std::string& filename, bool defer) if (!ServerConfig::FileExists(modfile)) { LastModuleError = "Module file could not be found: " + filename; - ServerInstance->Logs->Log("MODULE", DEFAULT, LastModuleError); + ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, LastModuleError); return false; } if (Modules.find(filename) != Modules.end()) { LastModuleError = "Module " + filename + " is already loaded, cannot load a module twice!"; - ServerInstance->Logs->Log("MODULE", DEFAULT, LastModuleError); + ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, LastModuleError); return false; } @@ -70,7 +70,7 @@ bool ModuleManager::Load(const std::string& filename, bool defer) std::string version = newhandle->GetVersion(); if (defer) { - ServerInstance->Logs->Log("MODULE", DEFAULT,"New module introduced: %s (Module version %s)", + ServerInstance->Logs->Log("MODULE", LOG_DEFAULT,"New module introduced: %s (Module version %s)", filename.c_str(), version.c_str()); } else @@ -78,14 +78,14 @@ bool ModuleManager::Load(const std::string& filename, bool defer) newmod->init(); Version v = newmod->GetVersion(); - ServerInstance->Logs->Log("MODULE", DEFAULT,"New module introduced: %s (Module version %s)%s", + ServerInstance->Logs->Log("MODULE", LOG_DEFAULT,"New module introduced: %s (Module version %s)%s", filename.c_str(), version.c_str(), (!(v.Flags & VF_VENDOR) ? " [3rd Party]" : " [Vendor]")); } } else { LastModuleError = "Unable to load " + filename + ": " + newhandle->LastError(); - ServerInstance->Logs->Log("MODULE", DEFAULT, LastModuleError); + ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, LastModuleError); delete newhandle; return false; } @@ -101,7 +101,7 @@ bool ModuleManager::Load(const std::string& filename, bool defer) else delete newhandle; LastModuleError = "Unable to load " + filename + ": " + modexcept.GetReason(); - ServerInstance->Logs->Log("MODULE", DEFAULT, LastModuleError); + ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, LastModuleError); return false; } @@ -123,7 +123,7 @@ bool ModuleManager::Load(const std::string& filename, bool defer) if (prioritizationState == PRIO_STATE_LAST) break; if (tries == 19) - ServerInstance->Logs->Log("MODULE", DEFAULT, "Hook priority dependency loop detected while loading " + filename); + ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, "Hook priority dependency loop detected while loading " + filename); } ServerInstance->ISupport.Build(); @@ -203,7 +203,7 @@ void ModuleManager::LoadAll() if (!Load(entry->d_name, true)) { - ServerInstance->Logs->Log("MODULE", DEFAULT, this->LastError()); + ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, this->LastError()); std::cout << std::endl << "[" << con_red << "*" << con_reset << "] " << this->LastError() << std::endl << std::endl; ServerInstance->Exit(EXIT_STATUS_MODULE); } @@ -222,7 +222,7 @@ void ModuleManager::LoadAll() if (!this->Load(name, true)) { - ServerInstance->Logs->Log("MODULE", DEFAULT, this->LastError()); + ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, this->LastError()); std::cout << std::endl << "[" << con_red << "*" << con_reset << "] " << this->LastError() << std::endl << std::endl; ServerInstance->Exit(EXIT_STATUS_MODULE); } @@ -233,13 +233,13 @@ void ModuleManager::LoadAll() Module* mod = i->second; try { - ServerInstance->Logs->Log("MODULE", DEBUG, "Initializing %s", i->first.c_str()); + ServerInstance->Logs->Log("MODULE", LOG_DEBUG, "Initializing %s", i->first.c_str()); mod->init(); } catch (CoreException& modexcept) { LastModuleError = "Unable to initialize " + mod->ModuleSourceFile + ": " + modexcept.GetReason(); - ServerInstance->Logs->Log("MODULE", DEFAULT, LastModuleError); + ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, LastModuleError); std::cout << std::endl << "[" << con_red << "*" << con_reset << "] " << LastModuleError << std::endl << std::endl; ServerInstance->Exit(EXIT_STATUS_MODULE); } @@ -259,7 +259,7 @@ void ModuleManager::LoadAll() break; if (tries == 19) { - ServerInstance->Logs->Log("MODULE", DEFAULT, "Hook priority dependency loop detected"); + ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, "Hook priority dependency loop detected"); ServerInstance->Exit(EXIT_STATUS_MODULE); } } diff --git a/src/modmanager_static.cpp b/src/modmanager_static.cpp index a8ba83274..23f30e1df 100644 --- a/src/modmanager_static.cpp +++ b/src/modmanager_static.cpp @@ -96,7 +96,7 @@ bool ModuleManager::Load(const std::string& name, bool defer) Modules[name] = mod; if (defer) { - ServerInstance->Logs->Log("MODULE", DEFAULT,"New module introduced: %s", name.c_str()); + ServerInstance->Logs->Log("MODULE", LOG_DEFAULT,"New module introduced: %s", name.c_str()); return true; } else @@ -108,7 +108,7 @@ bool ModuleManager::Load(const std::string& name, bool defer) { if (mod) DoSafeUnload(mod); - ServerInstance->Logs->Log("MODULE", DEFAULT, "Unable to load " + name + ": " + modexcept.GetReason()); + ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, "Unable to load " + name + ": " + modexcept.GetReason()); return false; } FOREACH_MOD(I_OnLoadModule,OnLoadModule(mod)); @@ -125,7 +125,7 @@ bool ModuleManager::Load(const std::string& name, bool defer) if (prioritizationState == PRIO_STATE_LAST) break; if (tries == 19) - ServerInstance->Logs->Log("MODULE", DEFAULT, "Hook priority dependency loop detected while loading " + name); + ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, "Hook priority dependency loop detected while loading " + name); } ServerInstance->ISupport.Build(); @@ -193,7 +193,7 @@ void ModuleManager::LoadAll() if (!this->Load(name, true)) { - ServerInstance->Logs->Log("MODULE", DEFAULT, this->LastError()); + ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, this->LastError()); std::cout << std::endl << "[" << con_red << "*" << con_reset << "] " << this->LastError() << std::endl << std::endl; ServerInstance->Exit(EXIT_STATUS_MODULE); } @@ -209,7 +209,7 @@ void ModuleManager::LoadAll() catch (CoreException& modexcept) { LastModuleError = "Unable to initialize " + mod->ModuleSourceFile + ": " + modexcept.GetReason(); - ServerInstance->Logs->Log("MODULE", DEFAULT, LastModuleError); + ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, LastModuleError); std::cout << std::endl << "[" << con_red << "*" << con_reset << "] " << LastModuleError << std::endl << std::endl; ServerInstance->Exit(EXIT_STATUS_MODULE); } @@ -229,7 +229,7 @@ void ModuleManager::LoadAll() break; if (tries == 19) { - ServerInstance->Logs->Log("MODULE", DEFAULT, "Hook priority dependency loop detected"); + ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, "Hook priority dependency loop detected"); ServerInstance->Exit(EXIT_STATUS_MODULE); } } diff --git a/src/modules.cpp b/src/modules.cpp index 767322fc9..7ac4d2062 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -331,13 +331,13 @@ bool ModuleManager::CanUnload(Module* mod) if (modfind == Modules.end() || modfind->second != mod) { LastModuleError = "Module " + mod->ModuleSourceFile + " is not loaded, cannot unload it!"; - ServerInstance->Logs->Log("MODULE", DEFAULT, LastModuleError); + ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, LastModuleError); return false; } if (mod->GetVersion().Flags & VF_STATIC) { LastModuleError = "Module " + mod->ModuleSourceFile + " not unloadable (marked static)"; - ServerInstance->Logs->Log("MODULE", DEFAULT, LastModuleError); + ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, LastModuleError); return false; } return true; @@ -395,7 +395,7 @@ void ModuleManager::DoSafeUnload(Module* mod) Modules.erase(modfind); ServerInstance->GlobalCulls.AddItem(mod); - ServerInstance->Logs->Log("MODULE", DEFAULT,"Module %s unloaded",mod->ModuleSourceFile.c_str()); + ServerInstance->Logs->Log("MODULE", LOG_DEFAULT,"Module %s unloaded",mod->ModuleSourceFile.c_str()); this->ModCount--; ServerInstance->ISupport.Build(); } diff --git a/src/modules/extra/m_ldapauth.cpp b/src/modules/extra/m_ldapauth.cpp index 0eb182228..5ae6594b3 100644 --- a/src/modules/extra/m_ldapauth.cpp +++ b/src/modules/extra/m_ldapauth.cpp @@ -378,7 +378,7 @@ public: attr_value.bv_val = const_cast<char*>(val.c_str()); attr_value.bv_len = val.length(); - ServerInstance->Logs->Log("m_ldapauth", DEBUG, "LDAP compare: %s=%s", attr.c_str(), val.c_str()); + ServerInstance->Logs->Log("m_ldapauth", LOG_DEBUG, "LDAP compare: %s=%s", attr.c_str(), val.c_str()); authed = (ldap_compare_ext_s(conn, DN, attr.c_str(), &attr_value, NULL, NULL) == LDAP_COMPARE_TRUE); diff --git a/src/modules/extra/m_mssql.cpp b/src/modules/extra/m_mssql.cpp index 3ba398783..f9c3ea590 100644 --- a/src/modules/extra/m_mssql.cpp +++ b/src/modules/extra/m_mssql.cpp @@ -254,7 +254,7 @@ class SQLConn : public classbase if (tds_process_simple_query(sock) != TDS_SUCCEED) { LoggingMutex->Lock(); - ServerInstance->Logs->Log("m_mssql",DEFAULT, "WARNING: Could not select database " + host.name + " for DB with id: " + host.id); + ServerInstance->Logs->Log("m_mssql",LOG_DEFAULT, "WARNING: Could not select database " + host.name + " for DB with id: " + host.id); LoggingMutex->Unlock(); CloseDB(); } @@ -262,7 +262,7 @@ class SQLConn : public classbase else { LoggingMutex->Lock(); - ServerInstance->Logs->Log("m_mssql",DEFAULT, "WARNING: Could not select database " + host.name + " for DB with id: " + host.id); + ServerInstance->Logs->Log("m_mssql",LOG_DEFAULT, "WARNING: Could not select database " + host.name + " for DB with id: " + host.id); LoggingMutex->Unlock(); CloseDB(); } @@ -270,7 +270,7 @@ class SQLConn : public classbase else { LoggingMutex->Lock(); - ServerInstance->Logs->Log("m_mssql",DEFAULT, "WARNING: Could not connect to DB with id: " + host.id); + ServerInstance->Logs->Log("m_mssql",LOG_DEFAULT, "WARNING: Could not connect to DB with id: " + host.id); LoggingMutex->Unlock(); CloseDB(); } @@ -429,7 +429,7 @@ class SQLConn : public classbase char* msquery = strdup(req->query.q.data()); LoggingMutex->Lock(); - ServerInstance->Logs->Log("m_mssql",DEBUG,"doing Query: %s",msquery); + ServerInstance->Logs->Log("m_mssql",LOG_DEBUG,"doing Query: %s",msquery); LoggingMutex->Unlock(); if (tds_submit_query(sock, msquery) != TDS_SUCCEED) { @@ -445,8 +445,8 @@ class SQLConn : public classbase int tds_res; while (tds_process_tokens(sock, &tds_res, NULL, TDS_TOKEN_RESULTS) == TDS_SUCCEED) { - //ServerInstance->Logs->Log("m_mssql",DEBUG,"<******> result type: %d", tds_res); - //ServerInstance->Logs->Log("m_mssql",DEBUG,"AFFECTED ROWS: %d", sock->rows_affected); + //ServerInstance->Logs->Log("m_mssql",LOG_DEBUG,"<******> result type: %d", tds_res); + //ServerInstance->Logs->Log("m_mssql",LOG_DEBUG,"AFFECTED ROWS: %d", sock->rows_affected); switch (tds_res) { case TDS_ROWFMT_RESULT: @@ -512,7 +512,7 @@ class SQLConn : public classbase { SQLConn* sc = (SQLConn*)pContext->parent; LoggingMutex->Lock(); - ServerInstance->Logs->Log("m_mssql", DEBUG, "Message for DB with id: %s -> %s", sc->host.id.c_str(), pMessage->message); + ServerInstance->Logs->Log("m_mssql", LOG_DEBUG, "Message for DB with id: %s -> %s", sc->host.id.c_str(), pMessage->message); LoggingMutex->Unlock(); return 0; } @@ -521,7 +521,7 @@ class SQLConn : public classbase { SQLConn* sc = (SQLConn*)pContext->parent; LoggingMutex->Lock(); - ServerInstance->Logs->Log("m_mssql", DEFAULT, "Error for DB with id: %s -> %s", sc->host.id.c_str(), pMessage->message); + ServerInstance->Logs->Log("m_mssql", LOG_DEFAULT, "Error for DB with id: %s -> %s", sc->host.id.c_str(), pMessage->message); LoggingMutex->Unlock(); return 0; } @@ -749,7 +749,7 @@ class ModuleMsSQL : public Module if (HasHost(hi)) { LoggingMutex->Lock(); - ServerInstance->Logs->Log("m_mssql",DEFAULT, "WARNING: A MsSQL connection with id: %s already exists. Aborting database open attempt.", hi.id.c_str()); + ServerInstance->Logs->Log("m_mssql",LOG_DEFAULT, "WARNING: A MsSQL connection with id: %s already exists. Aborting database open attempt.", hi.id.c_str()); LoggingMutex->Unlock(); return; } diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp index 84f159be1..ea94834f3 100644 --- a/src/modules/extra/m_pgsql.cpp +++ b/src/modules/extra/m_pgsql.cpp @@ -152,7 +152,7 @@ class SQLConn : public SQLProvider, public EventHandler { if (!DoConnect()) { - ServerInstance->Logs->Log("m_pgsql",DEFAULT, "WARNING: Could not connect to database " + tag->getString("id")); + ServerInstance->Logs->Log("m_pgsql",LOG_DEFAULT, "WARNING: Could not connect to database " + tag->getString("id")); DelayReconnect(); } } @@ -244,7 +244,7 @@ class SQLConn : public SQLProvider, public EventHandler if (!ServerInstance->SE->AddFd(this, FD_WANT_NO_WRITE | FD_WANT_NO_READ)) { - ServerInstance->Logs->Log("m_pgsql",DEBUG, "BUG: Couldn't add pgsql socket to socket engine"); + ServerInstance->Logs->Log("m_pgsql",LOG_DEBUG, "BUG: Couldn't add pgsql socket to socket engine"); return false; } @@ -417,7 +417,7 @@ restart: int error; PQescapeStringConn(sql, buffer, parm.c_str(), parm.length(), &error); if (error) - ServerInstance->Logs->Log("m_pgsql", DEBUG, "BUG: Apparently PQescapeStringConn() failed"); + ServerInstance->Logs->Log("m_pgsql", LOG_DEBUG, "BUG: Apparently PQescapeStringConn() failed"); #else PQescapeString (buffer, parm.c_str(), parm.length()); #endif @@ -452,7 +452,7 @@ restart: int error; PQescapeStringConn(sql, buffer, parm.c_str(), parm.length(), &error); if (error) - ServerInstance->Logs->Log("m_pgsql", DEBUG, "BUG: Apparently PQescapeStringConn() failed"); + ServerInstance->Logs->Log("m_pgsql", LOG_DEBUG, "BUG: Apparently PQescapeStringConn() failed"); #else PQescapeString (buffer, parm.c_str(), parm.length()); #endif diff --git a/src/modules/extra/m_regex_pcre.cpp b/src/modules/extra/m_regex_pcre.cpp index a23092879..e9d9aba8a 100644 --- a/src/modules/extra/m_regex_pcre.cpp +++ b/src/modules/extra/m_regex_pcre.cpp @@ -52,7 +52,7 @@ class PCRERegex : public Regex regex = pcre_compile(rx.c_str(), 0, &error, &erroffset, NULL); if (!regex) { - ServerInstance->Logs->Log("REGEX", DEBUG, "pcre_compile failed: /%s/ [%d] %s", rx.c_str(), erroffset, error); + ServerInstance->Logs->Log("REGEX", LOG_DEBUG, "pcre_compile failed: /%s/ [%d] %s", rx.c_str(), erroffset, error); throw PCREException(rx, error, erroffset); } } diff --git a/src/modules/extra/m_sqlite3.cpp b/src/modules/extra/m_sqlite3.cpp index 171c11f03..40f44557a 100644 --- a/src/modules/extra/m_sqlite3.cpp +++ b/src/modules/extra/m_sqlite3.cpp @@ -85,7 +85,7 @@ class SQLConn : public SQLProvider std::string host = tag->getString("hostname"); if (sqlite3_open_v2(host.c_str(), &conn, SQLITE_OPEN_READWRITE, 0) != SQLITE_OK) { - ServerInstance->Logs->Log("m_sqlite3",DEFAULT, "WARNING: Could not open DB with id: " + tag->getString("id")); + ServerInstance->Logs->Log("m_sqlite3",LOG_DEFAULT, "WARNING: Could not open DB with id: " + tag->getString("id")); conn = NULL; } } diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index 67a0dd24f..31beb258f 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -258,7 +258,7 @@ class ModuleSSLGnuTLS : public Module continue; const std::string& portid = port->bind_desc; - ServerInstance->Logs->Log("m_ssl_gnutls", DEFAULT, "m_ssl_gnutls.so: Enabling SSL for port %s", portid.c_str()); + ServerInstance->Logs->Log("m_ssl_gnutls", LOG_DEFAULT, "m_ssl_gnutls.so: Enabling SSL for port %s", portid.c_str()); if (port->bind_tag->getString("type", "clients") == "clients" && port->bind_addr != "127.0.0.1") { @@ -337,13 +337,13 @@ class ModuleSSLGnuTLS : public Module ret = gnutls_certificate_allocate_credentials(&x509_cred); cred_alloc = (ret >= 0); if (!cred_alloc) - ServerInstance->Logs->Log("m_ssl_gnutls",DEBUG, "m_ssl_gnutls.so: Failed to allocate certificate credentials: %s", gnutls_strerror(ret)); + ServerInstance->Logs->Log("m_ssl_gnutls",LOG_DEBUG, "m_ssl_gnutls.so: Failed to allocate certificate credentials: %s", gnutls_strerror(ret)); if((ret =gnutls_certificate_set_x509_trust_file(x509_cred, cafile.c_str(), GNUTLS_X509_FMT_PEM)) < 0) - ServerInstance->Logs->Log("m_ssl_gnutls",DEBUG, "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",LOG_DEBUG, "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->Logs->Log("m_ssl_gnutls",DEBUG, "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",LOG_DEBUG, "m_ssl_gnutls.so: Failed to set X.509 CRL file '%s': %s", crlfile.c_str(), gnutls_strerror(ret)); FileReader reader; @@ -392,13 +392,13 @@ class ModuleSSLGnuTLS : public Module if ((ret = gnutls_priority_init(&priority, priocstr, &prioerror)) < 0) { // gnutls did not understand the user supplied string, log and fall back to the default priorities - ServerInstance->Logs->Log("m_ssl_gnutls",DEFAULT, "m_ssl_gnutls.so: Failed to set priorities to \"%s\": %s Syntax error at position %u, falling back to default (NORMAL)", priorities.c_str(), gnutls_strerror(ret), (unsigned int) (prioerror - priocstr)); + ServerInstance->Logs->Log("m_ssl_gnutls",LOG_DEFAULT, "m_ssl_gnutls.so: Failed to set priorities to \"%s\": %s Syntax error at position %u, falling back to default (NORMAL)", priorities.c_str(), gnutls_strerror(ret), (unsigned int) (prioerror - priocstr)); gnutls_priority_init(&priority, "NORMAL", NULL); } #else if (priorities != "NORMAL") - ServerInstance->Logs->Log("m_ssl_gnutls",DEFAULT, "m_ssl_gnutls.so: You've set <gnutls:priority> to a value other than the default, but this is only supported with GnuTLS v2.1.7 or newer. Your GnuTLS version is older than that so the option will have no effect."); + ServerInstance->Logs->Log("m_ssl_gnutls",LOG_DEFAULT, "m_ssl_gnutls.so: You've set <gnutls:priority> to a value other than the default, but this is only supported with GnuTLS v2.1.7 or newer. Your GnuTLS version is older than that so the option will have no effect."); #endif #if(GNUTLS_VERSION_MAJOR < 2 || ( GNUTLS_VERSION_MAJOR == 2 && GNUTLS_VERSION_MINOR < 12 ) ) @@ -409,7 +409,7 @@ class ModuleSSLGnuTLS : public Module ret = gnutls_dh_params_init(&dh_params); dh_alloc = (ret >= 0); if (!dh_alloc) - ServerInstance->Logs->Log("m_ssl_gnutls",DEFAULT, "m_ssl_gnutls.so: Failed to initialise DH parameters: %s", gnutls_strerror(ret)); + ServerInstance->Logs->Log("m_ssl_gnutls",LOG_DEFAULT, "m_ssl_gnutls.so: Failed to initialise DH parameters: %s", gnutls_strerror(ret)); // This may be on a large (once a day or week) timer eventually. GenerateDHParams(); @@ -428,7 +428,7 @@ class ModuleSSLGnuTLS : public Module int ret; if((ret = gnutls_dh_params_generate2(dh_params, dh_bits)) < 0) - ServerInstance->Logs->Log("m_ssl_gnutls",DEFAULT, "m_ssl_gnutls.so: Failed to generate DH parameters (%d bits): %s", dh_bits, gnutls_strerror(ret)); + ServerInstance->Logs->Log("m_ssl_gnutls",LOG_DEFAULT, "m_ssl_gnutls.so: Failed to generate DH parameters (%d bits): %s", dh_bits, gnutls_strerror(ret)); } ~ModuleSSLGnuTLS() diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index 258a6a840..427439eb3 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -171,7 +171,7 @@ class ModuleSSLOpenSSL : public Module continue; const std::string& portid = port->bind_desc; - ServerInstance->Logs->Log("m_ssl_openssl", DEFAULT, "m_ssl_openssl.so: Enabling SSL for port %s", portid.c_str()); + ServerInstance->Logs->Log("m_ssl_openssl", LOG_DEFAULT, "m_ssl_openssl.so: Enabling SSL for port %s", portid.c_str()); if (port->bind_tag->getString("type", "clients") == "clients" && port->bind_addr != "127.0.0.1") { @@ -219,7 +219,7 @@ class ModuleSSLOpenSSL : public Module { if ((!SSL_CTX_set_cipher_list(ctx, ciphers.c_str())) || (!SSL_CTX_set_cipher_list(clictx, ciphers.c_str()))) { - ServerInstance->Logs->Log("m_ssl_openssl",DEFAULT, "m_ssl_openssl.so: Can't set cipher list to %s.", ciphers.c_str()); + ServerInstance->Logs->Log("m_ssl_openssl",LOG_DEFAULT, "m_ssl_openssl.so: Can't set cipher list to %s.", ciphers.c_str()); ERR_print_errors_cb(error_callback, this); } } @@ -229,20 +229,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->Logs->Log("m_ssl_openssl",DEFAULT, "m_ssl_openssl.so: Can't read certificate file %s. %s", certfile.c_str(), strerror(errno)); + ServerInstance->Logs->Log("m_ssl_openssl",LOG_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->Logs->Log("m_ssl_openssl",DEFAULT, "m_ssl_openssl.so: Can't read key file %s. %s", keyfile.c_str(), strerror(errno)); + ServerInstance->Logs->Log("m_ssl_openssl",LOG_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->Logs->Log("m_ssl_openssl",DEFAULT, "m_ssl_openssl.so: Can't read CA list from %s. This is only a problem if you want to verify client certificates, otherwise it's safe to ignore this message. Error: %s", cafile.c_str(), strerror(errno)); + ServerInstance->Logs->Log("m_ssl_openssl",LOG_DEFAULT, "m_ssl_openssl.so: Can't read CA list from %s. This is only a problem if you want to verify client certificates, otherwise it's safe to ignore this message. Error: %s", cafile.c_str(), strerror(errno)); ERR_print_errors_cb(error_callback, this); } @@ -251,7 +251,7 @@ class ModuleSSLOpenSSL : public Module if (dhpfile == NULL) { - ServerInstance->Logs->Log("m_ssl_openssl",DEFAULT, "m_ssl_openssl.so Couldn't open DH file %s: %s", dhfile.c_str(), strerror(errno)); + ServerInstance->Logs->Log("m_ssl_openssl",LOG_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 @@ -259,7 +259,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->Logs->Log("m_ssl_openssl",DEFAULT, "m_ssl_openssl.so: Couldn't set DH parameters %s. SSL errors follow:", dhfile.c_str()); + ServerInstance->Logs->Log("m_ssl_openssl",LOG_DEFAULT, "m_ssl_openssl.so: Couldn't set DH parameters %s. SSL errors follow:", dhfile.c_str()); ERR_print_errors_cb(error_callback, this); } } @@ -343,7 +343,7 @@ class ModuleSSLOpenSSL : public Module if (SSL_set_fd(session->sess, fd) == 0) { - ServerInstance->Logs->Log("m_ssl_openssl",DEBUG,"BUG: Can't set fd with SSL_set_fd: %d", fd); + ServerInstance->Logs->Log("m_ssl_openssl",LOG_DEBUG,"BUG: Can't set fd with SSL_set_fd: %d", fd); return; } @@ -368,7 +368,7 @@ class ModuleSSLOpenSSL : public Module if (SSL_set_fd(session->sess, fd) == 0) { - ServerInstance->Logs->Log("m_ssl_openssl",DEBUG,"BUG: Can't set fd with SSL_set_fd: %d", fd); + ServerInstance->Logs->Log("m_ssl_openssl",LOG_DEBUG,"BUG: Can't set fd with SSL_set_fd: %d", fd); return; } @@ -649,7 +649,7 @@ class ModuleSSLOpenSSL : public Module static int error_callback(const char *str, size_t len, void *u) { - ServerInstance->Logs->Log("m_ssl_openssl",DEFAULT, "SSL error: " + std::string(str, len - 1)); + ServerInstance->Logs->Log("m_ssl_openssl",LOG_DEFAULT, "SSL error: " + std::string(str, len - 1)); // // XXX: Remove this line, it causes valgrind warnings... diff --git a/src/modules/m_banredirect.cpp b/src/modules/m_banredirect.cpp index ffd47d793..8fda26ba6 100644 --- a/src/modules/m_banredirect.cpp +++ b/src/modules/m_banredirect.cpp @@ -342,7 +342,7 @@ class ModuleBanRedirect : public Module { /* XXX is this the best place to do this? */ if (!ServerInstance->Modes->DelModeWatcher(&re)) - ServerInstance->Logs->Log("m_banredirect.so", DEBUG, "Failed to delete modewatcher!"); + ServerInstance->Logs->Log("m_banredirect.so", LOG_DEBUG, "Failed to delete modewatcher!"); } virtual Version GetVersion() diff --git a/src/modules/m_blockcaps.cpp b/src/modules/m_blockcaps.cpp index 8371dd106..cd02fffe2 100644 --- a/src/modules/m_blockcaps.cpp +++ b/src/modules/m_blockcaps.cpp @@ -121,12 +121,12 @@ public: capsmap[(unsigned char)*n] = 1; if (percent < 1 || percent > 100) { - ServerInstance->Logs->Log("CONFIG",DEFAULT, "<blockcaps:percent> out of range, setting to default of 100."); + ServerInstance->Logs->Log("CONFIG",LOG_DEFAULT, "<blockcaps:percent> out of range, setting to default of 100."); percent = 100; } if (minlen < 1 || minlen > MAXBUF-1) { - ServerInstance->Logs->Log("CONFIG",DEFAULT, "<blockcaps:minlen> out of range, setting to default of 1."); + ServerInstance->Logs->Log("CONFIG",LOG_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 39833f1a0..7259f9459 100644 --- a/src/modules/m_cgiirc.cpp +++ b/src/modules/m_cgiirc.cpp @@ -255,7 +255,7 @@ public: { if (type == "webirc" && password.empty()) { - ServerInstance->Logs->Log("CONFIG",DEFAULT, "m_cgiirc: Missing password in config: %s", hostmask.c_str()); + ServerInstance->Logs->Log("CONFIG",LOG_DEFAULT, "m_cgiirc: Missing password in config: %s", hostmask.c_str()); } else { @@ -271,7 +271,7 @@ public: else { cgitype = PASS; - ServerInstance->Logs->Log("CONFIG",DEFAULT, "m_cgiirc.so: Invalid <cgihost:type> value in config: %s, setting it to \"pass\"", type.c_str()); + ServerInstance->Logs->Log("CONFIG",LOG_DEFAULT, "m_cgiirc.so: Invalid <cgihost:type> value in config: %s, setting it to \"pass\"", type.c_str()); } cmd.Hosts.push_back(CGIhost(hostmask, cgitype, password)); @@ -279,7 +279,7 @@ public: } else { - ServerInstance->Logs->Log("CONFIG",DEFAULT, "m_cgiirc.so: Invalid <cgihost:mask> value in config: %s", hostmask.c_str()); + ServerInstance->Logs->Log("CONFIG",LOG_DEFAULT, "m_cgiirc.so: Invalid <cgihost:mask> value in config: %s", hostmask.c_str()); continue; } } diff --git a/src/modules/m_chanlog.cpp b/src/modules/m_chanlog.cpp index 418175da3..4bfce2108 100644 --- a/src/modules/m_chanlog.cpp +++ b/src/modules/m_chanlog.cpp @@ -54,14 +54,14 @@ class ModuleChanLog : public Module if (channel.empty() || snomasks.empty()) { - ServerInstance->Logs->Log("m_chanlog", DEFAULT, "Malformed chanlog tag, ignoring"); + ServerInstance->Logs->Log("m_chanlog", LOG_DEFAULT, "Malformed chanlog tag, ignoring"); continue; } for (std::string::const_iterator it = snomasks.begin(); it != snomasks.end(); it++) { logstreams.insert(std::make_pair(*it, channel)); - ServerInstance->Logs->Log("m_chanlog", DEFAULT, "Logging %c to %s", *it, channel.c_str()); + ServerInstance->Logs->Log("m_chanlog", LOG_DEFAULT, "Logging %c to %s", *it, channel.c_str()); } } diff --git a/src/modules/m_connectban.cpp b/src/modules/m_connectban.cpp index de69ab7ed..e6bfdda1f 100644 --- a/src/modules/m_connectban.cpp +++ b/src/modules/m_connectban.cpp @@ -114,7 +114,7 @@ class ModuleConnectBan : public Module virtual void OnGarbageCollect() { - ServerInstance->Logs->Log("m_connectban",DEBUG, "Clearing map."); + ServerInstance->Logs->Log("m_connectban",LOG_DEBUG, "Clearing map."); connects.clear(); } }; diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp index 72414b7a5..8429eb21b 100644 --- a/src/modules/m_dnsbl.cpp +++ b/src/modules/m_dnsbl.cpp @@ -356,7 +356,7 @@ class ModuleDNSBL : public Module return; } else - ServerInstance->Logs->Log("m_dnsbl", DEBUG, "User has no connect class in OnSetUserIP"); + ServerInstance->Logs->Log("m_dnsbl", LOG_DEBUG, "User has no connect class in OnSetUserIP"); unsigned char a, b, c, d; char reversedipbuf[128]; diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp index ffa94fea8..7e7ded306 100644 --- a/src/modules/m_filter.cpp +++ b/src/modules/m_filter.cpp @@ -369,7 +369,7 @@ ModResult ModuleFilter::OnUserPreNotice(User* user,void* dest,int target_type, s delete gl; } - ServerInstance->Logs->Log("FILTER",DEFAULT,"FILTER: "+ user->nick + " had their message filtered, target was " + target + ": " + f->reason + " Action: " + ModuleFilter::FilterActionToString(f->action)); + ServerInstance->Logs->Log("FILTER",LOG_DEFAULT,"FILTER: "+ user->nick + " had their message filtered, target was " + target + ": " + f->reason + " Action: " + ModuleFilter::FilterActionToString(f->action)); return MOD_RES_DENY; } return MOD_RES_PASSTHRU; @@ -539,7 +539,7 @@ void ModuleFilter::OnDecodeMetaData(Extensible* target, const std::string &extna } catch (ModuleException& e) { - ServerInstance->Logs->Log("m_filter", DEBUG, "Error when unserializing filter: " + std::string(e.GetReason())); + ServerInstance->Logs->Log("m_filter", LOG_DEBUG, "Error when unserializing filter: " + std::string(e.GetReason())); } } } @@ -571,13 +571,13 @@ FilterResult* ModuleFilter::FilterMatch(User* user, const std::string &text, int InspIRCd::StripColor(stripped_text); } - //ServerInstance->Logs->Log("m_filter", DEBUG, "Match '%s' against '%s'", text.c_str(), index->freeform.c_str()); + //ServerInstance->Logs->Log("m_filter", LOG_DEBUG, "Match '%s' against '%s'", text.c_str(), index->freeform.c_str()); if (index->regex->Matches(filter->flag_strip_color ? stripped_text : text)) { - //ServerInstance->Logs->Log("m_filter", DEBUG, "MATCH"); + //ServerInstance->Logs->Log("m_filter", LOG_DEBUG, "MATCH"); return &*index; } - //ServerInstance->Logs->Log("m_filter", DEBUG, "NO MATCH"); + //ServerInstance->Logs->Log("m_filter", LOG_DEBUG, "NO MATCH"); } return NULL; } @@ -612,7 +612,7 @@ std::pair<bool, std::string> ModuleFilter::AddFilter(const std::string &freeform } catch (ModuleException &e) { - ServerInstance->Logs->Log("m_filter", DEFAULT, "Error in regular expression '%s': %s", freeform.c_str(), e.GetReason()); + ServerInstance->Logs->Log("m_filter", LOG_DEFAULT, "Error in regular expression '%s': %s", freeform.c_str(), e.GetReason()); return std::make_pair(false, e.GetReason()); } return std::make_pair(true, ""); @@ -672,11 +672,11 @@ void ModuleFilter::ReadFilters() try { filters.push_back(ImplFilter(this, reason, fa, gline_time, pattern, flgs)); - ServerInstance->Logs->Log("m_filter", DEFAULT, "Regular expression %s loaded.", pattern.c_str()); + ServerInstance->Logs->Log("m_filter", LOG_DEFAULT, "Regular expression %s loaded.", pattern.c_str()); } catch (ModuleException &e) { - ServerInstance->Logs->Log("m_filter", DEFAULT, "Error in regular expression '%s': %s", pattern.c_str(), e.GetReason()); + ServerInstance->Logs->Log("m_filter", LOG_DEFAULT, "Error in regular expression '%s': %s", pattern.c_str(), e.GetReason()); } } } diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp index 6462ee1f4..46f0d6907 100644 --- a/src/modules/m_httpd.cpp +++ b/src/modules/m_httpd.cpp @@ -216,7 +216,7 @@ class HttpServerSocket : public BufferedSocket if (reqbuffer.length() >= 8192) { - ServerInstance->Logs->Log("m_httpd",DEBUG, "m_httpd dropped connection due to an oversized request buffer"); + ServerInstance->Logs->Log("m_httpd",LOG_DEBUG, "m_httpd dropped connection due to an oversized request buffer"); reqbuffer.clear(); SetError("Buffer"); } diff --git a/src/modules/m_httpd_acl.cpp b/src/modules/m_httpd_acl.cpp index cddbce2f6..70c36a154 100644 --- a/src/modules/m_httpd_acl.cpp +++ b/src/modules/m_httpd_acl.cpp @@ -82,7 +82,7 @@ class ModuleHTTPAccessList : public Module } } - ServerInstance->Logs->Log("m_httpd_acl", DEBUG, "Read ACL: path=%s pass=%s whitelist=%s blacklist=%s", path.c_str(), + ServerInstance->Logs->Log("m_httpd_acl", LOG_DEBUG, "Read ACL: path=%s pass=%s whitelist=%s blacklist=%s", path.c_str(), password.c_str(), whitelist.c_str(), blacklist.c_str()); acl_list.push_back(HTTPACL(path, username, password, whitelist, blacklist)); @@ -98,7 +98,7 @@ class ModuleHTTPAccessList : public Module void BlockAccess(HTTPRequest* http, int returnval, const std::string &extraheaderkey = "", const std::string &extraheaderval="") { - ServerInstance->Logs->Log("m_httpd_acl", DEBUG, "BlockAccess (%d)", returnval); + ServerInstance->Logs->Log("m_httpd_acl", LOG_DEBUG, "BlockAccess (%d)", returnval); std::stringstream data("Access to this resource is denied by an access control list. Please contact your IRC administrator."); HTTPDocumentResponse response(this, *http, &data, returnval); @@ -112,7 +112,7 @@ class ModuleHTTPAccessList : public Module { if (event.id == "httpd_acl") { - ServerInstance->Logs->Log("m_http_stats", DEBUG,"Handling httpd acl event"); + ServerInstance->Logs->Log("m_http_stats", LOG_DEBUG,"Handling httpd acl event"); HTTPRequest* http = (HTTPRequest*)&event; for (std::vector<HTTPACL>::const_iterator this_acl = acl_list.begin(); this_acl != acl_list.end(); ++this_acl) @@ -129,7 +129,7 @@ class ModuleHTTPAccessList : public Module { if (InspIRCd::Match(http->GetIP(), entry, ascii_case_insensitive_map)) { - ServerInstance->Logs->Log("m_httpd_acl", DEBUG, "Denying access to blacklisted resource %s (matched by pattern %s) from ip %s (matched by entry %s)", + ServerInstance->Logs->Log("m_httpd_acl", LOG_DEBUG, "Denying access to blacklisted resource %s (matched by pattern %s) from ip %s (matched by entry %s)", http->GetURI().c_str(), this_acl->path.c_str(), http->GetIP().c_str(), entry.c_str()); BlockAccess(http, 403); return; @@ -151,7 +151,7 @@ class ModuleHTTPAccessList : public Module if (!allow_access) { - ServerInstance->Logs->Log("m_httpd_acl", DEBUG, "Denying access to whitelisted resource %s (matched by pattern %s) from ip %s (Not in whitelist)", + ServerInstance->Logs->Log("m_httpd_acl", LOG_DEBUG, "Denying access to whitelisted resource %s (matched by pattern %s) from ip %s (Not in whitelist)", http->GetURI().c_str(), this_acl->path.c_str(), http->GetIP().c_str()); BlockAccess(http, 403); return; @@ -160,7 +160,7 @@ class ModuleHTTPAccessList : public Module if (!this_acl->password.empty() && !this_acl->username.empty()) { /* Password auth, first look to see if we have a basic authentication header */ - ServerInstance->Logs->Log("m_httpd_acl", DEBUG, "Checking HTTP auth password for resource %s (matched by pattern %s) from ip %s, against username %s", + ServerInstance->Logs->Log("m_httpd_acl", LOG_DEBUG, "Checking HTTP auth password for resource %s (matched by pattern %s) from ip %s, against username %s", http->GetURI().c_str(), this_acl->path.c_str(), http->GetIP().c_str(), this_acl->username.c_str()); if (http->headers->IsSet("Authorization")) @@ -179,7 +179,7 @@ class ModuleHTTPAccessList : public Module sep.GetToken(base64); std::string userpass = Base64ToBin(base64); - ServerInstance->Logs->Log("m_httpd_acl", DEBUG, "HTTP authorization: %s (%s)", userpass.c_str(), base64.c_str()); + ServerInstance->Logs->Log("m_httpd_acl", LOG_DEBUG, "HTTP authorization: %s (%s)", userpass.c_str(), base64.c_str()); irc::sepstream userpasspair(userpass, ':'); if (userpasspair.GetToken(user)) @@ -189,7 +189,7 @@ class ModuleHTTPAccessList : public Module /* Access granted if username and password are correct */ if (user == this_acl->username && pass == this_acl->password) { - ServerInstance->Logs->Log("m_httpd_acl", DEBUG, "HTTP authorization: password and username match"); + ServerInstance->Logs->Log("m_httpd_acl", LOG_DEBUG, "HTTP authorization: password and username match"); return; } else diff --git a/src/modules/m_httpd_config.cpp b/src/modules/m_httpd_config.cpp index a28db34ab..88594e2fe 100644 --- a/src/modules/m_httpd_config.cpp +++ b/src/modules/m_httpd_config.cpp @@ -73,7 +73,7 @@ class ModuleHttpConfig : public Module if (event.id == "httpd_url") { - ServerInstance->Logs->Log("m_http_stats", DEBUG,"Handling httpd event"); + ServerInstance->Logs->Log("m_http_stats", LOG_DEBUG,"Handling httpd event"); HTTPRequest* http = (HTTPRequest*)&event; if ((http->GetURI() == "/config") || (http->GetURI() == "/config/")) diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp index 691fa8163..2eb9f7cb7 100644 --- a/src/modules/m_httpd_stats.cpp +++ b/src/modules/m_httpd_stats.cpp @@ -97,7 +97,7 @@ class ModuleHttpStats : public Module if (event.id == "httpd_url") { - ServerInstance->Logs->Log("m_http_stats", DEBUG,"Handling httpd event"); + ServerInstance->Logs->Log("m_http_stats", LOG_DEBUG,"Handling httpd event"); HTTPRequest* http = (HTTPRequest*)&event; if ((http->GetURI() == "/stats") || (http->GetURI() == "/stats/")) diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp index 6653cf6c3..f38ad2241 100644 --- a/src/modules/m_ident.cpp +++ b/src/modules/m_ident.cpp @@ -144,7 +144,7 @@ class IdentRequestSocket : public EventHandler virtual void OnConnected() { - ServerInstance->Logs->Log("m_ident",DEBUG,"OnConnected()"); + ServerInstance->Logs->Log("m_ident",LOG_DEBUG,"OnConnected()"); ServerInstance->SE->ChangeEventMask(this, FD_WANT_POLL_READ | FD_WANT_NO_WRITE); char req[32]; @@ -179,7 +179,7 @@ class IdentRequestSocket : public EventHandler break; case EVENT_ERROR: /* fd error event, ohshi- */ - ServerInstance->Logs->Log("m_ident",DEBUG,"EVENT_ERROR"); + ServerInstance->Logs->Log("m_ident",LOG_DEBUG,"EVENT_ERROR"); /* We *must* Close() here immediately or we get a * huge storm of EVENT_ERROR events! */ @@ -196,7 +196,7 @@ class IdentRequestSocket : public EventHandler */ if (GetFd() > -1) { - ServerInstance->Logs->Log("m_ident",DEBUG,"Close ident socket %d", GetFd()); + ServerInstance->Logs->Log("m_ident",LOG_DEBUG,"Close ident socket %d", GetFd()); ServerInstance->SE->DelFd(this); ServerInstance->SE->Close(GetFd()); this->SetFd(-1); @@ -228,7 +228,7 @@ class IdentRequestSocket : public EventHandler if (recvresult < 3) return; - ServerInstance->Logs->Log("m_ident",DEBUG,"ReadResponse()"); + ServerInstance->Logs->Log("m_ident",LOG_DEBUG,"ReadResponse()"); /* Truncate at the first null character, but first make sure * there is at least one null char (at the end of the buffer). @@ -316,7 +316,7 @@ class ModuleIdent : public Module } catch (ModuleException &e) { - ServerInstance->Logs->Log("m_ident",DEBUG,"Ident exception: %s", e.GetReason()); + ServerInstance->Logs->Log("m_ident",LOG_DEBUG,"Ident exception: %s", e.GetReason()); } } @@ -330,11 +330,11 @@ class ModuleIdent : public Module IdentRequestSocket *isock = ext.get(user); if (!isock) { - ServerInstance->Logs->Log("m_ident",DEBUG, "No ident socket :("); + ServerInstance->Logs->Log("m_ident",LOG_DEBUG, "No ident socket :("); return MOD_RES_PASSTHRU; } - ServerInstance->Logs->Log("m_ident",DEBUG, "Has ident_socket"); + ServerInstance->Logs->Log("m_ident",LOG_DEBUG, "Has ident_socket"); time_t compare = isock->age; compare += RequestTimeout; @@ -344,16 +344,16 @@ class ModuleIdent : public Module { /* Ident timeout */ user->WriteServ("NOTICE Auth :*** Ident request timed out."); - ServerInstance->Logs->Log("m_ident",DEBUG, "Timeout"); + ServerInstance->Logs->Log("m_ident",LOG_DEBUG, "Timeout"); } else if (!isock->HasResult()) { // time still good, no result yet... hold the registration - ServerInstance->Logs->Log("m_ident",DEBUG, "No result yet"); + ServerInstance->Logs->Log("m_ident",LOG_DEBUG, "No result yet"); return MOD_RES_DENY; } - ServerInstance->Logs->Log("m_ident",DEBUG, "Yay, result!"); + ServerInstance->Logs->Log("m_ident",LOG_DEBUG, "Yay, result!"); /* wooo, got a result (it will be good, or bad) */ if (isock->result.empty()) diff --git a/src/modules/m_nationalchars.cpp b/src/modules/m_nationalchars.cpp index b59d278db..f4cd13a85 100644 --- a/src/modules/m_nationalchars.cpp +++ b/src/modules/m_nationalchars.cpp @@ -305,7 +305,7 @@ class ModuleNationalChars : public Module std::ifstream ifs(filename.c_str()); if (ifs.fail()) { - ServerInstance->Logs->Log("m_nationalchars",DEFAULT,"loadtables() called for missing file: %s", filename.c_str()); + ServerInstance->Logs->Log("m_nationalchars",LOG_DEFAULT,"loadtables() called for missing file: %s", filename.c_str()); return; } @@ -320,7 +320,7 @@ class ModuleNationalChars : public Module { if (loadtable(ifs, tables[n], 255) && (n < faillimit)) { - ServerInstance->Logs->Log("m_nationalchars",DEFAULT,"loadtables() called for illegal file: %s (line %d)", filename.c_str(), n+1); + ServerInstance->Logs->Log("m_nationalchars",LOG_DEFAULT,"loadtables() called for illegal file: %s (line %d)", filename.c_str(), n+1); return; } } diff --git a/src/modules/m_operlog.cpp b/src/modules/m_operlog.cpp index 03984618b..b39c4fe58 100644 --- a/src/modules/m_operlog.cpp +++ b/src/modules/m_operlog.cpp @@ -61,7 +61,7 @@ class ModuleOperLog : public Module if (!parameters.empty()) line = irc::stringjoiner(" ", parameters, 0, parameters.size() - 1).GetJoined(); std::string msg = "[" + user->GetFullRealHost() + "] " + command + " " + line; - ServerInstance->Logs->Log("m_operlog", DEFAULT, "OPERLOG: " + msg); + ServerInstance->Logs->Log("m_operlog", LOG_DEFAULT, "OPERLOG: " + msg); if (tosnomask) ServerInstance->SNO->WriteGlobalSno('r', msg); } diff --git a/src/modules/m_permchannels.cpp b/src/modules/m_permchannels.cpp index b12b9bbeb..27026bde9 100644 --- a/src/modules/m_permchannels.cpp +++ b/src/modules/m_permchannels.cpp @@ -44,7 +44,7 @@ static bool WriteDatabase() f = fopen(tempname.c_str(), "w"); if (!f) { - ServerInstance->Logs->Log("m_permchannels",DEFAULT, "permchannels: Cannot create database! %s (%d)", strerror(errno), errno); + ServerInstance->Logs->Log("m_permchannels",LOG_DEFAULT, "permchannels: Cannot create database! %s (%d)", strerror(errno), errno); ServerInstance->SNO->WriteToSnoMask('a', "database: cannot create new db: %s (%d)", strerror(errno), errno); return false; } @@ -95,7 +95,7 @@ static bool WriteDatabase() write_error |= fclose(f); if (write_error) { - ServerInstance->Logs->Log("m_permchannels",DEFAULT, "permchannels: Cannot write to new database! %s (%d)", strerror(errno), errno); + ServerInstance->Logs->Log("m_permchannels",LOG_DEFAULT, "permchannels: Cannot write to new database! %s (%d)", strerror(errno), errno); ServerInstance->SNO->WriteToSnoMask('a', "database: cannot write to new db: %s (%d)", strerror(errno), errno); return false; } @@ -103,7 +103,7 @@ static bool WriteDatabase() #ifdef _WIN32 if (remove(permchannelsconf.c_str())) { - ServerInstance->Logs->Log("m_permchannels",DEFAULT, "permchannels: Cannot remove old database! %s (%d)", strerror(errno), errno); + ServerInstance->Logs->Log("m_permchannels",LOG_DEFAULT, "permchannels: Cannot remove old database! %s (%d)", strerror(errno), errno); ServerInstance->SNO->WriteToSnoMask('a', "database: cannot remove old database: %s (%d)", strerror(errno), errno); return false; } @@ -111,7 +111,7 @@ static bool WriteDatabase() // Use rename to move temporary to new db - this is guarenteed not to fuck up, even in case of a crash. if (rename(tempname.c_str(), permchannelsconf.c_str()) < 0) { - ServerInstance->Logs->Log("m_permchannels",DEFAULT, "permchannels: Cannot move new to old database! %s (%d)", strerror(errno), errno); + ServerInstance->Logs->Log("m_permchannels",LOG_DEFAULT, "permchannels: Cannot move new to old database! %s (%d)", strerror(errno), errno); ServerInstance->SNO->WriteToSnoMask('a', "database: cannot replace old with new db: %s (%d)", strerror(errno), errno); return false; } @@ -229,7 +229,7 @@ public: if (channel.empty()) { - ServerInstance->Logs->Log("m_permchannels", DEBUG, "Malformed permchannels tag with empty channel name."); + ServerInstance->Logs->Log("m_permchannels", LOG_DEBUG, "Malformed permchannels tag with empty channel name."); continue; } @@ -250,7 +250,7 @@ public: */ c->topicset = 42; } - ServerInstance->Logs->Log("m_permchannels", DEBUG, "Added %s with topic %s", channel.c_str(), topic.c_str()); + ServerInstance->Logs->Log("m_permchannels", LOG_DEBUG, "Added %s with topic %s", channel.c_str(), topic.c_str()); if (modes.empty()) continue; diff --git a/src/modules/m_redirect.cpp b/src/modules/m_redirect.cpp index e2acb6af1..4d59c34ba 100644 --- a/src/modules/m_redirect.cpp +++ b/src/modules/m_redirect.cpp @@ -121,7 +121,7 @@ class ModuleRedirect : public Module if (UseUsermode) { /* Log noting that this breaks compatability. */ - ServerInstance->Logs->Log("m_redirect", DEFAULT, "REDIRECT: Enabled usermode +L. This breaks linking with servers that do not have this enabled. This is disabled by default in the 2.0 branch but will be enabled in the next version."); + ServerInstance->Logs->Log("m_redirect", LOG_DEFAULT, "REDIRECT: Enabled usermode +L. This breaks linking with servers that do not have this enabled. This is disabled by default in the 2.0 branch but will be enabled in the next version."); /* Try to add the usermode */ ServerInstance->Modules->AddService(re_u); diff --git a/src/modules/m_ripemd160.cpp b/src/modules/m_ripemd160.cpp index 9cbd0c69b..e487d6e30 100644 --- a/src/modules/m_ripemd160.cpp +++ b/src/modules/m_ripemd160.cpp @@ -164,7 +164,7 @@ class RIProv : public HashProvider { if (key) { - ServerInstance->Logs->Log("m_ripemd160.so", DEBUG, "initialize with custom mdbuf"); + ServerInstance->Logs->Log("m_ripemd160.so", LOG_DEBUG, "initialize with custom mdbuf"); MDbuf[0] = key[0]; MDbuf[1] = key[1]; MDbuf[2] = key[2]; @@ -173,7 +173,7 @@ class RIProv : public HashProvider } else { - ServerInstance->Logs->Log("m_ripemd160.so", DEBUG, "initialize with default mdbuf"); + ServerInstance->Logs->Log("m_ripemd160.so", LOG_DEBUG, "initialize with default mdbuf"); MDbuf[0] = 0x67452301UL; MDbuf[1] = 0xefcdab89UL; MDbuf[2] = 0x98badcfeUL; @@ -414,7 +414,7 @@ class RIProv : public HashProvider byte *RMD(byte *message, dword length, unsigned int* key) { - ServerInstance->Logs->Log("m_ripemd160", DEBUG, "RMD: '%s' length=%u", (const char*)message, length); + ServerInstance->Logs->Log("m_ripemd160", LOG_DEBUG, "RMD: '%s' length=%u", (const char*)message, length); dword MDbuf[RMDsize/32]; /* contains (A, B, C, D(E)) */ static byte hashcode[RMDsize/8]; /* for final hash-value */ dword X[16]; /* current 16-word chunk */ diff --git a/src/modules/m_sasl.cpp b/src/modules/m_sasl.cpp index 0f2f9022e..ff007f799 100644 --- a/src/modules/m_sasl.cpp +++ b/src/modules/m_sasl.cpp @@ -112,7 +112,7 @@ class SaslAuthenticator case SASL_DONE: break; default: - ServerInstance->Logs->Log("m_sasl", DEFAULT, "WTF: SaslState is not a known state (%d)", this->state); + ServerInstance->Logs->Log("m_sasl", LOG_DEFAULT, "WTF: SaslState is not a known state (%d)", this->state); break; } @@ -220,7 +220,7 @@ class CommandSASL : public Command User* target = ServerInstance->FindNick(parameters[1]); if ((!target) || (IS_SERVER(target))) { - ServerInstance->Logs->Log("m_sasl", DEBUG,"User not found in sasl ENCAP event: %s", parameters[1].c_str()); + ServerInstance->Logs->Log("m_sasl", LOG_DEBUG,"User not found in sasl ENCAP event: %s", parameters[1].c_str()); return CMD_FAILURE; } @@ -266,7 +266,7 @@ class ModuleSASL : public Module ServerInstance->Modules->AddServices(providelist, 3); if (!ServerInstance->Modules->Find("m_services_account.so") || !ServerInstance->Modules->Find("m_cap.so")) - ServerInstance->Logs->Log("m_sasl", DEFAULT, "WARNING: m_services_account.so and m_cap.so are not loaded! m_sasl.so will NOT function correctly until these two modules are loaded!"); + ServerInstance->Logs->Log("m_sasl", LOG_DEFAULT, "WARNING: m_services_account.so and m_cap.so are not loaded! m_sasl.so will NOT function correctly until these two modules are loaded!"); } void OnRehash(User*) diff --git a/src/modules/m_spanningtree/compat.cpp b/src/modules/m_spanningtree/compat.cpp index 92f2bc8f4..32bdb3df8 100644 --- a/src/modules/m_spanningtree/compat.cpp +++ b/src/modules/m_spanningtree/compat.cpp @@ -29,7 +29,7 @@ void TreeSocket::WriteLine(std::string line) { if (line[0] != ':') { - ServerInstance->Logs->Log("m_spanningtree", DEFAULT, "Sending line without server prefix!"); + ServerInstance->Logs->Log("m_spanningtree", LOG_DEFAULT, "Sending line without server prefix!"); line = ":" + ServerInstance->Config->GetSID() + " " + line; } if (proto_version != ProtocolVersion) @@ -42,7 +42,7 @@ void TreeSocket::WriteLine(std::string line) } } - ServerInstance->Logs->Log("m_spanningtree", RAWIO, "S[%d] O %s", this->GetFd(), line.c_str()); + ServerInstance->Logs->Log("m_spanningtree", LOG_RAWIO, "S[%d] O %s", this->GetFd(), line.c_str()); this->WriteData(line); this->WriteData(newline); } diff --git a/src/modules/m_spanningtree/fjoin.cpp b/src/modules/m_spanningtree/fjoin.cpp index a90c62924..29ee9244c 100644 --- a/src/modules/m_spanningtree/fjoin.cpp +++ b/src/modules/m_spanningtree/fjoin.cpp @@ -70,7 +70,7 @@ CmdResult CommandFJoin::Handle(const std::vector<std::string>& params, User *src if (!TS) { - ServerInstance->Logs->Log("m_spanningtree",DEFAULT,"*** BUG? *** TS of 0 sent to FJOIN. Are some services authors smoking craq, or is it 1970 again?. Dropped."); + ServerInstance->Logs->Log("m_spanningtree",LOG_DEFAULT,"*** BUG? *** TS of 0 sent to FJOIN. Are some services authors smoking craq, or is it 1970 again?. Dropped."); ServerInstance->SNO->WriteToSnoMask('d', "WARNING: The server %s is sending FJOIN with a TS of zero. Total craq. Command was dropped.", srcuser->server.c_str()); return CMD_INVALID; } @@ -152,7 +152,7 @@ CmdResult CommandFJoin::Handle(const std::vector<std::string>& params, User *src ModeHandler *mh = ServerInstance->Modes->FindMode(*unparsedmodes, MODETYPE_CHANNEL); if (!mh) { - ServerInstance->Logs->Log("m_spanningtree", SPARSE, "Unrecognised mode %c, dropping link", *unparsedmodes); + ServerInstance->Logs->Log("m_spanningtree", LOG_SPARSE, "Unrecognised mode %c, dropping link", *unparsedmodes); return CMD_INVALID; } @@ -181,7 +181,7 @@ CmdResult CommandFJoin::Handle(const std::vector<std::string>& params, User *src } else { - ServerInstance->Logs->Log("m_spanningtree",SPARSE, "Ignored nonexistant user %s in fjoin to %s (probably quit?)", usr, channel.c_str()); + ServerInstance->Logs->Log("m_spanningtree",LOG_SPARSE, "Ignored nonexistant user %s in fjoin to %s (probably quit?)", usr, channel.c_str()); continue; } } diff --git a/src/modules/m_spanningtree/fmode.cpp b/src/modules/m_spanningtree/fmode.cpp index c1e452db6..5dd77c360 100644 --- a/src/modules/m_spanningtree/fmode.cpp +++ b/src/modules/m_spanningtree/fmode.cpp @@ -72,7 +72,7 @@ CmdResult CommandFMode::Handle(const std::vector<std::string>& params, User *who if (!TS) { - ServerInstance->Logs->Log("m_spanningtree",DEFAULT,"*** BUG? *** TS of 0 sent to FMODE. Are some services authors smoking craq, or is it 1970 again?. Dropped."); + ServerInstance->Logs->Log("m_spanningtree",LOG_DEFAULT,"*** BUG? *** TS of 0 sent to FMODE. Are some services authors smoking craq, or is it 1970 again?. Dropped."); ServerInstance->SNO->WriteToSnoMask('d', "WARNING: The server %s is sending FMODE with a TS of zero. Total craq. Mode was dropped.", sourceserv.c_str()); return CMD_INVALID; } diff --git a/src/modules/m_spanningtree/hmac.cpp b/src/modules/m_spanningtree/hmac.cpp index 65b3a5997..8dc18cbbd 100644 --- a/src/modules/m_spanningtree/hmac.cpp +++ b/src/modules/m_spanningtree/hmac.cpp @@ -65,7 +65,7 @@ std::string TreeSocket::MakePass(const std::string &password, const std::string return "AUTH:" + BinToBase64(sha256->hmac(password, challenge)); if (!challenge.empty() && !sha256) - ServerInstance->Logs->Log("m_spanningtree",DEFAULT,"Not authenticating to server using SHA256/HMAC because we don't have m_sha256 loaded!"); + ServerInstance->Logs->Log("m_spanningtree",LOG_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/main.cpp b/src/modules/m_spanningtree/main.cpp index efd899c44..9aee4a4ce 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -758,7 +758,7 @@ void ModuleSpanningTree::OnPreRehash(User* user, const std::string ¶meter) if (loopCall) return; // Don't generate a REHASH here if we're in the middle of processing a message that generated this one - ServerInstance->Logs->Log("remoterehash", DEBUG, "called with param %s", parameter.c_str()); + ServerInstance->Logs->Log("remoterehash", LOG_DEBUG, "called with param %s", parameter.c_str()); // Send out to other servers if (!parameter.empty() && parameter[0] != '-') diff --git a/src/modules/m_spanningtree/override_map.cpp b/src/modules/m_spanningtree/override_map.cpp index 69f088f65..5c69aef16 100644 --- a/src/modules/m_spanningtree/override_map.cpp +++ b/src/modules/m_spanningtree/override_map.cpp @@ -38,7 +38,7 @@ const std::string ModuleSpanningTree::MapOperInfo(TreeServer* Current) void ModuleSpanningTree::ShowMap(TreeServer* Current, User* user, int depth, int &line, char* names, int &maxnamew, char* stats) { - ServerInstance->Logs->Log("map",DEBUG,"ShowMap depth %d on line %d", depth, line); + ServerInstance->Logs->Log("map",LOG_DEBUG,"ShowMap depth %d on line %d", depth, line); float percent; if (ServerInstance->Users->clientlist->size() == 0) @@ -174,7 +174,7 @@ bool ModuleSpanningTree::HandleMap(const std::vector<std::string>& parameters, U float avg_users = totusers * 1.0 / line; - ServerInstance->Logs->Log("map",DEBUG,"local"); + ServerInstance->Logs->Log("map",LOG_DEBUG,"local"); for (int t = 0; t < line; t++) { // terminate the string at maxnamew characters diff --git a/src/modules/m_spanningtree/postcommand.cpp b/src/modules/m_spanningtree/postcommand.cpp index 471bbfcb9..b91435eee 100644 --- a/src/modules/m_spanningtree/postcommand.cpp +++ b/src/modules/m_spanningtree/postcommand.cpp @@ -73,7 +73,7 @@ void SpanningTreeUtilities::RouteCommand(TreeServer* origin, const std::string & TreeServer* sdest = FindServer(routing.serverdest); if (!sdest) { - ServerInstance->Logs->Log("m_spanningtree",DEFAULT,"Trying to route ENCAP to nonexistant server %s", + ServerInstance->Logs->Log("m_spanningtree",LOG_DEFAULT,"Trying to route ENCAP to nonexistant server %s", routing.serverdest.c_str()); return; } @@ -88,7 +88,7 @@ void SpanningTreeUtilities::RouteCommand(TreeServer* origin, const std::string & if (!(ver.Flags & (VF_COMMON | VF_CORE)) && srcmodule != Creator) { - ServerInstance->Logs->Log("m_spanningtree",DEFAULT,"Routed command %s from non-VF_COMMON module %s", + ServerInstance->Logs->Log("m_spanningtree",LOG_DEFAULT,"Routed command %s from non-VF_COMMON module %s", command.c_str(), srcmodule->ModuleSourceFile.c_str()); return; } diff --git a/src/modules/m_spanningtree/resolvers.cpp b/src/modules/m_spanningtree/resolvers.cpp index d7c4c5227..671300111 100644 --- a/src/modules/m_spanningtree/resolvers.cpp +++ b/src/modules/m_spanningtree/resolvers.cpp @@ -107,6 +107,6 @@ void SecurityIPResolver::OnError(ResolverError e, const std::string &errormessag ServerInstance->AddResolver(res, cached); return; } - ServerInstance->Logs->Log("m_spanningtree",DEFAULT,"Could not resolve IP associated with Link '%s': %s", + ServerInstance->Logs->Log("m_spanningtree",LOG_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 e6cec5cb4..d266b31f4 100644 --- a/src/modules/m_spanningtree/server.cpp +++ b/src/modules/m_spanningtree/server.cpp @@ -237,7 +237,7 @@ bool TreeSocket::Inbound_Server(parameterlist ¶ms) } /* Check for fully initialized instances of the server by id */ - ServerInstance->Logs->Log("m_spanningtree",DEBUG,"Looking for dupe SID %s", sid.c_str()); + ServerInstance->Logs->Log("m_spanningtree",LOG_DEBUG,"Looking for dupe SID %s", sid.c_str()); CheckDupe = Utils->FindServerID(sid); if (CheckDupe) diff --git a/src/modules/m_spanningtree/treeserver.cpp b/src/modules/m_spanningtree/treeserver.cpp index 493b05ebf..6213483ee 100644 --- a/src/modules/m_spanningtree/treeserver.cpp +++ b/src/modules/m_spanningtree/treeserver.cpp @@ -70,7 +70,7 @@ TreeServer::TreeServer(SpanningTreeUtilities* Util, std::string Name, std::strin long ts = ServerInstance->Time() * 1000 + (ServerInstance->Time_ns() / 1000000); this->StartBurst = ts; - ServerInstance->Logs->Log("m_spanningtree",DEBUG, "Started bursting at time %lu", ts); + ServerInstance->Logs->Log("m_spanningtree",LOG_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) @@ -158,7 +158,7 @@ void TreeServer::FinishBurst() void TreeServer::SetID(const std::string &id) { - ServerInstance->Logs->Log("m_spanningtree",DEBUG, "Setting SID to " + id); + ServerInstance->Logs->Log("m_spanningtree",LOG_DEBUG, "Setting SID to " + id); sid = id; Utils->sidlist[sid] = this; } diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp index 6582ba060..26171ee72 100644 --- a/src/modules/m_spanningtree/treesocket1.cpp +++ b/src/modules/m_spanningtree/treesocket1.cpp @@ -158,7 +158,7 @@ void TreeSocket::SendError(const std::string &errormessage) void TreeSocket::SquitServer(std::string &from, TreeServer* Current, int& num_lost_servers, int& num_lost_users) { std::string servername = Current->GetName(); - ServerInstance->Logs->Log("m_spanningtree",DEBUG,"SquitServer for %s from %s", + ServerInstance->Logs->Log("m_spanningtree",LOG_DEBUG,"SquitServer for %s from %s", servername.c_str(), from.c_str()); /* recursively squit the servers attached to 'Current'. * We're going backwards so we don't remove users @@ -220,7 +220,7 @@ void TreeSocket::Squit(TreeServer* Current, const std::string &reason) } } else - ServerInstance->Logs->Log("m_spanningtree",DEFAULT,"Squit from unknown server"); + ServerInstance->Logs->Log("m_spanningtree",LOG_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 bcf4cee12..e2eb31f0d 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -84,7 +84,7 @@ void TreeSocket::ProcessLine(std::string &line) std::string command; parameterlist params; - ServerInstance->Logs->Log("m_spanningtree", RAWIO, "S[%d] I %s", this->GetFd(), line.c_str()); + ServerInstance->Logs->Log("m_spanningtree", LOG_RAWIO, "S[%d] I %s", this->GetFd(), line.c_str()); Split(line, prefix, command, params); @@ -259,7 +259,7 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command, } else { - ServerInstance->Logs->Log("m_spanningtree", DEBUG, "Command '%s' from unknown prefix '%s'! Dropping entire command.", + ServerInstance->Logs->Log("m_spanningtree", LOG_DEBUG, "Command '%s' from unknown prefix '%s'! Dropping entire command.", command.c_str(), prefix.c_str()); return; } @@ -290,7 +290,7 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command, if ((!route_back_again) || (route_back_again->GetSocket() != this)) { if (route_back_again) - ServerInstance->Logs->Log("m_spanningtree",DEBUG,"Protocol violation: Fake direction '%s' from connection '%s'", + ServerInstance->Logs->Log("m_spanningtree",LOG_DEBUG,"Protocol violation: Fake direction '%s' from connection '%s'", prefix.c_str(),linkID.c_str()); return; } @@ -459,7 +459,7 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command, if (!cmd) { irc::stringjoiner pmlist(" ", params, 0, params.size() - 1); - ServerInstance->Logs->Log("m_spanningtree", SPARSE, "Unrecognised S2S command :%s %s %s", + ServerInstance->Logs->Log("m_spanningtree", LOG_SPARSE, "Unrecognised S2S command :%s %s %s", who->uuid.c_str(), command.c_str(), pmlist.GetJoined().c_str()); SendError("Unrecognised command '" + command + "' -- possibly loaded mismatched modules"); return; @@ -468,7 +468,7 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command, if (params.size() < cmd->min_params) { irc::stringjoiner pmlist(" ", params, 0, params.size() - 1); - ServerInstance->Logs->Log("m_spanningtree", SPARSE, "Insufficient parameters for S2S command :%s %s %s", + ServerInstance->Logs->Log("m_spanningtree", LOG_SPARSE, "Insufficient parameters for S2S command :%s %s %s", who->uuid.c_str(), command.c_str(), pmlist.GetJoined().c_str()); SendError("Insufficient parameters for command '" + command + "'"); return; @@ -487,7 +487,7 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command, if (res == CMD_INVALID) { irc::stringjoiner pmlist(" ", params, 0, params.size() - 1); - ServerInstance->Logs->Log("m_spanningtree", SPARSE, "Error handling S2S command :%s %s %s", + ServerInstance->Logs->Log("m_spanningtree", LOG_SPARSE, "Error handling S2S command :%s %s %s", who->uuid.c_str(), command.c_str(), pmlist.GetJoined().c_str()); SendError("Error handling '" + command + "' -- possibly loaded mismatched modules"); } diff --git a/src/modules/m_spanningtree/uid.cpp b/src/modules/m_spanningtree/uid.cpp index 3f73d8ee8..d6bded5e5 100644 --- a/src/modules/m_spanningtree/uid.cpp +++ b/src/modules/m_spanningtree/uid.cpp @@ -65,7 +65,7 @@ CmdResult CommandUID::Handle(const parameterlist ¶ms, User* serversrc) * Nick collision. */ int collide = sock->DoCollision(iter->second, age_t, params[5], params[6], params[0]); - ServerInstance->Logs->Log("m_spanningtree",DEBUG,"*** Collision on %s, collide=%d", params[2].c_str(), collide); + ServerInstance->Logs->Log("m_spanningtree",LOG_DEBUG,"*** Collision on %s, collide=%d", params[2].c_str(), collide); if (collide != 1) { @@ -88,7 +88,7 @@ CmdResult CommandUID::Handle(const parameterlist ¶ms, User* serversrc) } catch (...) { - ServerInstance->Logs->Log("m_spanningtree", DEFAULT, "Duplicate UUID %s in client introduction", params[0].c_str()); + ServerInstance->Logs->Log("m_spanningtree", LOG_DEFAULT, "Duplicate UUID %s in client introduction", params[0].c_str()); return CMD_INVALID; } (*(ServerInstance->Users->clientlist))[params[2]] = _new; diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp index 13d188432..1517ac1b9 100644 --- a/src/modules/m_spanningtree/utils.cpp +++ b/src/modules/m_spanningtree/utils.cpp @@ -132,7 +132,7 @@ TreeServer* SpanningTreeUtilities::FindServerID(const std::string &id) SpanningTreeUtilities::SpanningTreeUtilities(ModuleSpanningTree* C) : Creator(C) { - ServerInstance->Logs->Log("m_spanningtree",DEBUG,"***** Using SID for hash: %s *****", ServerInstance->Config->GetSID().c_str()); + ServerInstance->Logs->Log("m_spanningtree",LOG_DEBUG,"***** Using SID for hash: %s *****", ServerInstance->Config->GetSID().c_str()); this->TreeRoot = new TreeServer(this, ServerInstance->Config->ServerName, ServerInstance->Config->ServerDesc, ServerInstance->Config->GetSID()); this->ReadConfiguration(); @@ -298,7 +298,7 @@ void SpanningTreeUtilities::RefreshIPCache() Link* L = *i; if (!L->Port) { - ServerInstance->Logs->Log("m_spanningtree",DEFAULT,"m_spanningtree: Ignoring a link block without a port."); + ServerInstance->Logs->Log("m_spanningtree",LOG_DEFAULT,"m_spanningtree: Ignoring a link block without a port."); /* Invalid link block */ continue; } @@ -389,11 +389,11 @@ void SpanningTreeUtilities::ReadConfiguration() if (L->IPAddr.empty()) { L->IPAddr = "*"; - ServerInstance->Logs->Log("m_spanningtree",DEFAULT,"Configuration warning: Link block '" + assign(L->Name) + "' has no IP defined! This will allow any IP to connect as this server, and MAY not be what you want."); + ServerInstance->Logs->Log("m_spanningtree",LOG_DEFAULT,"Configuration warning: Link block '" + assign(L->Name) + "' has no IP defined! This will allow any IP to connect as this server, and MAY not be what you want."); } if (!L->Port) - ServerInstance->Logs->Log("m_spanningtree",DEFAULT,"Configuration warning: Link block '" + assign(L->Name) + "' has no port defined, you will not be able to /connect it."); + ServerInstance->Logs->Log("m_spanningtree",LOG_DEFAULT,"Configuration warning: Link block '" + assign(L->Name) + "' has no port defined, you will not be able to /connect it."); L->Fingerprint.erase(std::remove(L->Fingerprint.begin(), L->Fingerprint.end(), ':'), L->Fingerprint.end()); LinkBlocks.push_back(L); diff --git a/src/modules/m_sqloper.cpp b/src/modules/m_sqloper.cpp index 4e8126dbf..881b8d6d2 100644 --- a/src/modules/m_sqloper.cpp +++ b/src/modules/m_sqloper.cpp @@ -48,7 +48,7 @@ class OpMeQuery : public SQLQuery void OnResult(SQLResult& res) { - ServerInstance->Logs->Log("m_sqloper",DEBUG, "SQLOPER: result for %s", uid.c_str()); + ServerInstance->Logs->Log("m_sqloper",LOG_DEBUG, "SQLOPER: result for %s", uid.c_str()); User* user = ServerInstance->FindNick(uid); if (!user) return; @@ -60,14 +60,14 @@ class OpMeQuery : public SQLQuery if (OperUser(user, row[0], row[1])) return; } - ServerInstance->Logs->Log("m_sqloper",DEBUG, "SQLOPER: no matches for %s (checked %d rows)", uid.c_str(), res.Rows()); + ServerInstance->Logs->Log("m_sqloper",LOG_DEBUG, "SQLOPER: no matches for %s (checked %d rows)", uid.c_str(), res.Rows()); // nobody succeeded... fall back to OPER fallback(); } void OnError(SQLerror& error) { - ServerInstance->Logs->Log("m_sqloper",DEFAULT, "SQLOPER: query failed (%s)", error.Str()); + ServerInstance->Logs->Log("m_sqloper",LOG_DEFAULT, "SQLOPER: query failed (%s)", error.Str()); fallback(); } @@ -88,7 +88,7 @@ class OpMeQuery : public SQLQuery } else { - ServerInstance->Logs->Log("m_sqloper",SPARSE, "BUG: WHAT?! Why do we have no OPER command?!"); + ServerInstance->Logs->Log("m_sqloper",LOG_SPARSE, "BUG: WHAT?! Why do we have no OPER command?!"); } } @@ -97,7 +97,7 @@ class OpMeQuery : public SQLQuery OperIndex::iterator iter = ServerInstance->Config->oper_blocks.find(" " + type); if (iter == ServerInstance->Config->oper_blocks.end()) { - ServerInstance->Logs->Log("m_sqloper",DEFAULT, "SQLOPER: bad type '%s' in returned row for oper %s", type.c_str(), username.c_str()); + ServerInstance->Logs->Log("m_sqloper",LOG_DEFAULT, "SQLOPER: bad type '%s' in returned row for oper %s", type.c_str(), username.c_str()); return false; } OperInfo* ifo = iter->second; @@ -159,7 +159,7 @@ public: /* Query is in progress, it will re-invoke OPER if needed */ return MOD_RES_DENY; } - ServerInstance->Logs->Log("m_sqloper",DEFAULT, "SQLOPER: database not present"); + ServerInstance->Logs->Log("m_sqloper",LOG_DEFAULT, "SQLOPER: database not present"); } return MOD_RES_PASSTHRU; } diff --git a/src/modules/m_topiclock.cpp b/src/modules/m_topiclock.cpp index 3e8a846e7..3194f6e9b 100644 --- a/src/modules/m_topiclock.cpp +++ b/src/modules/m_topiclock.cpp @@ -47,7 +47,7 @@ class CommandSVSTOPIC : public Command time_t topicts = ConvToInt(parameters[1]); if (!topicts) { - ServerInstance->Logs->Log("m_topiclock", DEFAULT, "Received SVSTOPIC with a 0 topicts, dropped."); + ServerInstance->Logs->Log("m_topiclock", LOG_DEFAULT, "Received SVSTOPIC with a 0 topicts, dropped."); return CMD_INVALID; } diff --git a/src/modules/m_xline_db.cpp b/src/modules/m_xline_db.cpp index ced9bfd93..0c23527ee 100644 --- a/src/modules/m_xline_db.cpp +++ b/src/modules/m_xline_db.cpp @@ -93,17 +93,17 @@ class ModuleXLineDB : public Module * Technically, that means that this can block, but I have *never* seen that. * -- w00t */ - ServerInstance->Logs->Log("m_xline_db",DEBUG, "xlinedb: Opening temporary database"); + ServerInstance->Logs->Log("m_xline_db",LOG_DEBUG, "xlinedb: Opening temporary database"); std::string xlinenewdbpath = xlinedbpath + ".new"; f = fopen(xlinenewdbpath.c_str(), "w"); if (!f) { - ServerInstance->Logs->Log("m_xline_db",DEBUG, "xlinedb: Cannot create database! %s (%d)", strerror(errno), errno); + ServerInstance->Logs->Log("m_xline_db",LOG_DEBUG, "xlinedb: Cannot create database! %s (%d)", strerror(errno), errno); ServerInstance->SNO->WriteToSnoMask('a', "database: cannot create new db: %s (%d)", strerror(errno), errno); return false; } - ServerInstance->Logs->Log("m_xline_db",DEBUG, "xlinedb: Opened. Writing.."); + ServerInstance->Logs->Log("m_xline_db",LOG_DEBUG, "xlinedb: Opened. Writing.."); /* * Now, much as I hate writing semi-unportable formats, additional @@ -130,14 +130,14 @@ class ModuleXLineDB : public Module } } - ServerInstance->Logs->Log("m_xline_db",DEBUG, "xlinedb: Finished writing XLines. Checking for error.."); + ServerInstance->Logs->Log("m_xline_db",LOG_DEBUG, "xlinedb: Finished writing XLines. Checking for error.."); int write_error = 0; write_error = ferror(f); write_error |= fclose(f); if (write_error) { - ServerInstance->Logs->Log("m_xline_db",DEBUG, "xlinedb: Cannot write to new database! %s (%d)", strerror(errno), errno); + ServerInstance->Logs->Log("m_xline_db",LOG_DEBUG, "xlinedb: Cannot write to new database! %s (%d)", strerror(errno), errno); ServerInstance->SNO->WriteToSnoMask('a', "database: cannot write to new db: %s (%d)", strerror(errno), errno); return false; } @@ -145,7 +145,7 @@ class ModuleXLineDB : public Module #ifdef _WIN32 if (remove(xlinedbpath.c_str())) { - ServerInstance->Logs->Log("m_xline_db",DEBUG, "xlinedb: Cannot remove old database! %s (%d)", strerror(errno), errno); + ServerInstance->Logs->Log("m_xline_db",LOG_DEBUG, "xlinedb: Cannot remove old database! %s (%d)", strerror(errno), errno); ServerInstance->SNO->WriteToSnoMask('a', "database: cannot remove old database: %s (%d)", strerror(errno), errno); return false; } @@ -153,7 +153,7 @@ class ModuleXLineDB : public Module // Use rename to move temporary to new db - this is guarenteed not to fuck up, even in case of a crash. if (rename(xlinenewdbpath.c_str(), xlinedbpath.c_str()) < 0) { - ServerInstance->Logs->Log("m_xline_db",DEBUG, "xlinedb: Cannot move new to old database! %s (%d)", strerror(errno), errno); + ServerInstance->Logs->Log("m_xline_db",LOG_DEBUG, "xlinedb: Cannot move new to old database! %s (%d)", strerror(errno), errno); ServerInstance->SNO->WriteToSnoMask('a', "database: cannot replace old with new db: %s (%d)", strerror(errno), errno); return false; } @@ -177,7 +177,7 @@ class ModuleXLineDB : public Module else { /* this might be slightly more problematic. */ - ServerInstance->Logs->Log("m_xline_db",DEBUG, "xlinedb: Cannot read database! %s (%d)", strerror(errno), errno); + ServerInstance->Logs->Log("m_xline_db",LOG_DEBUG, "xlinedb: Cannot read database! %s (%d)", strerror(errno), errno); ServerInstance->SNO->WriteToSnoMask('a', "database: cannot read db: %s (%d)", strerror(errno), errno); return false; } @@ -209,18 +209,18 @@ class ModuleXLineDB : public Module items++; } - ServerInstance->Logs->Log("m_xline_db",DEBUG, "xlinedb: Processing %s", linebuf); + ServerInstance->Logs->Log("m_xline_db",LOG_DEBUG, "xlinedb: Processing %s", linebuf); if (command_p[0] == "VERSION") { if (command_p[1] == "1") { - ServerInstance->Logs->Log("m_xline_db",DEBUG, "xlinedb: Reading db version %s", command_p[1].c_str()); + ServerInstance->Logs->Log("m_xline_db",LOG_DEBUG, "xlinedb: Reading db version %s", command_p[1].c_str()); } else { fclose(f); - ServerInstance->Logs->Log("m_xline_db",DEBUG, "xlinedb: I got database version %s - I don't understand it", command_p[1].c_str()); + ServerInstance->Logs->Log("m_xline_db",LOG_DEBUG, "xlinedb: I got database version %s - I don't understand it", command_p[1].c_str()); ServerInstance->SNO->WriteToSnoMask('a', "database: I got a database version (%s) I don't understand", command_p[1].c_str()); return false; } diff --git a/src/snomasks.cpp b/src/snomasks.cpp index 4b9c9d86b..8ab5682d6 100644 --- a/src/snomasks.cpp +++ b/src/snomasks.cpp @@ -104,7 +104,7 @@ void Snomask::SendMessage(const std::string &message, char mysnomask) if (isupper(mysnomask)) desc = "REMOTE" + desc; ModResult MOD_RESULT; - ServerInstance->Logs->Log("snomask", DEFAULT, "%s: %s", desc.c_str(), message.c_str()); + ServerInstance->Logs->Log("snomask", LOG_DEFAULT, "%s: %s", desc.c_str(), message.c_str()); FIRST_MOD_RESULT(OnSendSnotice, MOD_RESULT, (mysnomask, desc, message)); @@ -141,7 +141,7 @@ void Snomask::Flush() desc = "REMOTE" + desc; std::string mesg = "(last message repeated "+ConvToStr(Count)+" times)"; - ServerInstance->Logs->Log("snomask", DEFAULT, "%s: %s", desc.c_str(), mesg.c_str()); + ServerInstance->Logs->Log("snomask", LOG_DEFAULT, "%s: %s", desc.c_str(), mesg.c_str()); FOREACH_MOD(I_OnSendSnotice, OnSendSnotice(LastLetter, desc, mesg)); diff --git a/src/socket.cpp b/src/socket.cpp index 6fc7b13f8..da6d2fc6b 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -58,19 +58,19 @@ bool InspIRCd::BindSocket(int sockfd, int port, const char* addr, bool dolisten) { if (SE->Listen(sockfd, Config->MaxConn) == -1) { - this->Logs->Log("SOCKET",DEFAULT,"ERROR in listen(): %s",strerror(errno)); + this->Logs->Log("SOCKET",LOG_DEFAULT,"ERROR in listen(): %s",strerror(errno)); return false; } else { - this->Logs->Log("SOCKET",DEBUG,"New socket binding for %d with listen: %s:%d", sockfd, addr, port); + this->Logs->Log("SOCKET",LOG_DEBUG,"New socket binding for %d with listen: %s:%d", sockfd, addr, port); SE->NonBlocking(sockfd); return true; } } else { - this->Logs->Log("SOCKET",DEBUG,"New socket binding for %d without listen: %s:%d", sockfd, addr, port); + this->Logs->Log("SOCKET",LOG_DEBUG,"New socket binding for %d without listen: %s:%d", sockfd, addr, port); return true; } } @@ -89,7 +89,7 @@ int InspIRCd::BindPorts(FailedPortList &failed_ports) std::string Addr = tag->getString("address"); if (strncasecmp(Addr.c_str(), "::ffff:", 7) == 0) - this->Logs->Log("SOCKET",DEFAULT, "Using 4in6 (::ffff:) isn't recommended. You should bind IPv4 addresses directly instead."); + this->Logs->Log("SOCKET",LOG_DEFAULT, "Using 4in6 (::ffff:) isn't recommended. You should bind IPv4 addresses directly instead."); irc::portparser portrange(porttag, false); int portno = -1; @@ -136,11 +136,11 @@ int InspIRCd::BindPorts(FailedPortList &failed_ports) n++; if (n == ports.end()) { - this->Logs->Log("SOCKET",DEFAULT,"Port bindings slipped out of vector, aborting close!"); + this->Logs->Log("SOCKET",LOG_DEFAULT,"Port bindings slipped out of vector, aborting close!"); break; } - this->Logs->Log("SOCKET",DEFAULT, "Port binding %s was removed from the config file, closing.", + this->Logs->Log("SOCKET",LOG_DEFAULT, "Port binding %s was removed from the config file, closing.", (**n).bind_desc.c_str()); delete *n; diff --git a/src/socketengines/socketengine_epoll.cpp b/src/socketengines/socketengine_epoll.cpp index f7e107e7b..895d8aa25 100644 --- a/src/socketengines/socketengine_epoll.cpp +++ b/src/socketengines/socketengine_epoll.cpp @@ -61,7 +61,7 @@ EPollEngine::EPollEngine() } else { - ServerInstance->Logs->Log("SOCKET", DEFAULT, "ERROR: Can't determine maximum number of open sockets!"); + ServerInstance->Logs->Log("SOCKET", LOG_DEFAULT, "ERROR: Can't determine maximum number of open sockets!"); std::cout << "ERROR: Can't determine maximum number of open sockets!" << std::endl; ServerInstance->Exit(EXIT_STATUS_SOCKETENGINE); } @@ -71,8 +71,8 @@ EPollEngine::EPollEngine() if (EngineHandle == -1) { - 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."); + ServerInstance->Logs->Log("SOCKET",LOG_DEFAULT, "ERROR: Could not initialize socket engine: %s", strerror(errno)); + ServerInstance->Logs->Log("SOCKET",LOG_DEFAULT, "ERROR: Your kernel probably does not have the proper features. This is a fatal error, exiting now."); std::cout << "ERROR: Could not initialize epoll socket engine: " << strerror(errno) << std::endl; std::cout << "ERROR: Your kernel probably does not have the proper features. This is a fatal error, exiting now." << std::endl; ServerInstance->Exit(EXIT_STATUS_SOCKETENGINE); @@ -119,13 +119,13 @@ bool EPollEngine::AddFd(EventHandler* eh, int event_mask) int fd = eh->GetFd(); if ((fd < 0) || (fd > GetMaxFds() - 1)) { - ServerInstance->Logs->Log("SOCKET",DEBUG,"AddFd out of range: (fd: %d, max: %d)", fd, GetMaxFds()); + ServerInstance->Logs->Log("SOCKET",LOG_DEBUG,"AddFd out of range: (fd: %d, max: %d)", fd, GetMaxFds()); return false; } if (ref[fd]) { - ServerInstance->Logs->Log("SOCKET",DEBUG,"Attempt to add duplicate fd: %d", fd); + ServerInstance->Logs->Log("SOCKET",LOG_DEBUG,"Attempt to add duplicate fd: %d", fd); return false; } @@ -136,11 +136,11 @@ bool EPollEngine::AddFd(EventHandler* eh, int event_mask) int i = epoll_ctl(EngineHandle, EPOLL_CTL_ADD, fd, &ev); if (i < 0) { - ServerInstance->Logs->Log("SOCKET",DEBUG,"Error adding fd: %d to socketengine: %s", fd, strerror(errno)); + ServerInstance->Logs->Log("SOCKET",LOG_DEBUG,"Error adding fd: %d to socketengine: %s", fd, strerror(errno)); return false; } - ServerInstance->Logs->Log("SOCKET",DEBUG,"New file descriptor: %d", fd); + ServerInstance->Logs->Log("SOCKET",LOG_DEBUG,"New file descriptor: %d", fd); ref[fd] = eh; SocketEngine::SetEventMask(eh, event_mask); @@ -168,7 +168,7 @@ void EPollEngine::DelFd(EventHandler* eh) int fd = eh->GetFd(); if ((fd < 0) || (fd > GetMaxFds() - 1)) { - ServerInstance->Logs->Log("SOCKET",DEBUG,"DelFd out of range: (fd: %d, max: %d)", fd, GetMaxFds()); + ServerInstance->Logs->Log("SOCKET",LOG_DEBUG,"DelFd out of range: (fd: %d, max: %d)", fd, GetMaxFds()); return; } @@ -179,12 +179,12 @@ void EPollEngine::DelFd(EventHandler* eh) if (i < 0) { - ServerInstance->Logs->Log("SOCKET",DEBUG,"epoll_ctl can't remove socket: %s", strerror(errno)); + ServerInstance->Logs->Log("SOCKET",LOG_DEBUG,"epoll_ctl can't remove socket: %s", strerror(errno)); } ref[fd] = NULL; - ServerInstance->Logs->Log("SOCKET",DEBUG,"Remove file descriptor: %d", fd); + ServerInstance->Logs->Log("SOCKET",LOG_DEBUG,"Remove file descriptor: %d", fd); CurrentSetSize--; } @@ -202,7 +202,7 @@ int EPollEngine::DispatchEvents() EventHandler* eh = ref[events[j].data.fd]; if (!eh) { - ServerInstance->Logs->Log("SOCKET",DEBUG,"Got event on unknown fd: %d", events[j].data.fd); + ServerInstance->Logs->Log("SOCKET",LOG_DEBUG,"Got event on unknown fd: %d", events[j].data.fd); epoll_ctl(EngineHandle, EPOLL_CTL_DEL, events[j].data.fd, &events[j]); continue; } diff --git a/src/socketengines/socketengine_kqueue.cpp b/src/socketengines/socketengine_kqueue.cpp index e24146943..7bd123297 100644 --- a/src/socketengines/socketengine_kqueue.cpp +++ b/src/socketengines/socketengine_kqueue.cpp @@ -72,7 +72,7 @@ KQueueEngine::KQueueEngine() sysctl(mib, 2, &MAX_DESCRIPTORS, &len, NULL, 0); if (MAX_DESCRIPTORS <= 0) { - ServerInstance->Logs->Log("SOCKET", DEFAULT, "ERROR: Can't determine maximum number of open sockets!"); + ServerInstance->Logs->Log("SOCKET", LOG_DEFAULT, "ERROR: Can't determine maximum number of open sockets!"); std::cout << "ERROR: Can't determine maximum number of open sockets!" << std::endl; ServerInstance->Exit(EXIT_STATUS_SOCKETENGINE); } @@ -93,8 +93,8 @@ void KQueueEngine::RecoverFromFork() EngineHandle = kqueue(); if (EngineHandle == -1) { - 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."); + ServerInstance->Logs->Log("SOCKET",LOG_DEFAULT, "ERROR: Could not initialize socket engine. Your kernel probably does not have the proper features."); + ServerInstance->Logs->Log("SOCKET",LOG_DEFAULT, "ERROR: this is a fatal error, exiting now."); std::cout << "ERROR: Could not initialize socket engine. Your kernel probably does not have the proper features." << std::endl; std::cout << "ERROR: this is a fatal error, exiting now." << std::endl; ServerInstance->Exit(EXIT_STATUS_SOCKETENGINE); @@ -126,7 +126,7 @@ bool KQueueEngine::AddFd(EventHandler* eh, int event_mask) int i = kevent(EngineHandle, &ke, 1, 0, 0, NULL); if (i == -1) { - ServerInstance->Logs->Log("SOCKET",DEFAULT,"Failed to add fd: %d %s", + ServerInstance->Logs->Log("SOCKET",LOG_DEFAULT,"Failed to add fd: %d %s", fd, strerror(errno)); return false; } @@ -136,7 +136,7 @@ bool KQueueEngine::AddFd(EventHandler* eh, int event_mask) OnSetEvent(eh, 0, event_mask); CurrentSetSize++; - ServerInstance->Logs->Log("SOCKET",DEBUG,"New file descriptor: %d", fd); + ServerInstance->Logs->Log("SOCKET",LOG_DEBUG,"New file descriptor: %d", fd); return true; } @@ -146,7 +146,7 @@ void KQueueEngine::DelFd(EventHandler* eh) if ((fd < 0) || (fd > GetMaxFds() - 1)) { - ServerInstance->Logs->Log("SOCKET",DEFAULT,"DelFd() on invalid fd: %d", fd); + ServerInstance->Logs->Log("SOCKET",LOG_DEFAULT,"DelFd() on invalid fd: %d", fd); return; } @@ -163,14 +163,14 @@ void KQueueEngine::DelFd(EventHandler* eh) if (j < 0) { - ServerInstance->Logs->Log("SOCKET",DEFAULT,"Failed to remove fd: %d %s", + ServerInstance->Logs->Log("SOCKET",LOG_DEFAULT,"Failed to remove fd: %d %s", fd, strerror(errno)); } CurrentSetSize--; ref[fd] = NULL; - ServerInstance->Logs->Log("SOCKET",DEBUG,"Remove file descriptor: %d", fd); + ServerInstance->Logs->Log("SOCKET",LOG_DEBUG,"Remove file descriptor: %d", fd); } void KQueueEngine::OnSetEvent(EventHandler* eh, int old_mask, int new_mask) @@ -182,7 +182,7 @@ void KQueueEngine::OnSetEvent(EventHandler* eh, int old_mask, int new_mask) EV_SET(&ke, eh->GetFd(), EVFILT_WRITE, EV_ADD, 0, 0, NULL); int i = kevent(EngineHandle, &ke, 1, 0, 0, NULL); if (i < 0) { - ServerInstance->Logs->Log("SOCKET",DEFAULT,"Failed to mark for writing: %d %s", + ServerInstance->Logs->Log("SOCKET",LOG_DEFAULT,"Failed to mark for writing: %d %s", eh->GetFd(), strerror(errno)); } } @@ -193,7 +193,7 @@ void KQueueEngine::OnSetEvent(EventHandler* eh, int old_mask, int new_mask) EV_SET(&ke, eh->GetFd(), EVFILT_WRITE, EV_DELETE, 0, 0, NULL); int i = kevent(EngineHandle, &ke, 1, 0, 0, NULL); if (i < 0) { - ServerInstance->Logs->Log("SOCKET",DEFAULT,"Failed to mark for writing: %d %s", + ServerInstance->Logs->Log("SOCKET",LOG_DEFAULT,"Failed to mark for writing: %d %s", eh->GetFd(), strerror(errno)); } } @@ -204,7 +204,7 @@ void KQueueEngine::OnSetEvent(EventHandler* eh, int old_mask, int new_mask) EV_SET(&ke, eh->GetFd(), EVFILT_WRITE, EV_ADD | EV_ONESHOT, 0, 0, NULL); int i = kevent(EngineHandle, &ke, 1, 0, 0, NULL); if (i < 0) { - ServerInstance->Logs->Log("SOCKET",DEFAULT,"Failed to mark for writing: %d %s", + ServerInstance->Logs->Log("SOCKET",LOG_DEFAULT,"Failed to mark for writing: %d %s", eh->GetFd(), strerror(errno)); } } diff --git a/src/socketengines/socketengine_poll.cpp b/src/socketengines/socketengine_poll.cpp index 7d2f4d565..fd3360c36 100644 --- a/src/socketengines/socketengine_poll.cpp +++ b/src/socketengines/socketengine_poll.cpp @@ -102,7 +102,7 @@ PollEngine::PollEngine() } else { - ServerInstance->Logs->Log("SOCKET", DEFAULT, "ERROR: Can't determine maximum number of open sockets: %s", strerror(errno)); + ServerInstance->Logs->Log("SOCKET", LOG_DEFAULT, "ERROR: Can't determine maximum number of open sockets: %s", strerror(errno)); std::cout << "ERROR: Can't determine maximum number of open sockets: " << strerror(errno) << std::endl; ServerInstance->Exit(EXIT_STATUS_SOCKETENGINE); } @@ -137,13 +137,13 @@ bool PollEngine::AddFd(EventHandler* eh, int event_mask) int fd = eh->GetFd(); if ((fd < 0) || (fd > GetMaxFds() - 1)) { - ServerInstance->Logs->Log("SOCKET",DEBUG,"AddFd out of range: (fd: %d, max: %d)", fd, GetMaxFds()); + ServerInstance->Logs->Log("SOCKET",LOG_DEBUG,"AddFd out of range: (fd: %d, max: %d)", fd, GetMaxFds()); return false; } if (fd_mappings.find(fd) != fd_mappings.end()) { - ServerInstance->Logs->Log("SOCKET",DEBUG,"Attempt to add duplicate fd: %d", fd); + ServerInstance->Logs->Log("SOCKET",LOG_DEBUG,"Attempt to add duplicate fd: %d", fd); return false; } @@ -154,7 +154,7 @@ bool PollEngine::AddFd(EventHandler* eh, int event_mask) events[index].fd = fd; events[index].events = mask_to_poll(event_mask); - ServerInstance->Logs->Log("SOCKET", DEBUG,"New file descriptor: %d (%d; index %d)", fd, events[fd].events, index); + ServerInstance->Logs->Log("SOCKET", LOG_DEBUG,"New file descriptor: %d (%d; index %d)", fd, events[fd].events, index); SocketEngine::SetEventMask(eh, event_mask); CurrentSetSize++; return true; @@ -173,7 +173,7 @@ void PollEngine::OnSetEvent(EventHandler* eh, int old_mask, int new_mask) std::map<int, unsigned int>::iterator it = fd_mappings.find(eh->GetFd()); if (it == fd_mappings.end()) { - ServerInstance->Logs->Log("SOCKET",DEBUG,"SetEvents() on unknown fd: %d", eh->GetFd()); + ServerInstance->Logs->Log("SOCKET",LOG_DEBUG,"SetEvents() on unknown fd: %d", eh->GetFd()); return; } @@ -185,14 +185,14 @@ void PollEngine::DelFd(EventHandler* eh) int fd = eh->GetFd(); if ((fd < 0) || (fd > MAX_DESCRIPTORS)) { - ServerInstance->Logs->Log("SOCKET", DEBUG, "DelFd out of range: (fd: %d, max: %d)", fd, GetMaxFds()); + ServerInstance->Logs->Log("SOCKET", LOG_DEBUG, "DelFd out of range: (fd: %d, max: %d)", fd, GetMaxFds()); return; } std::map<int, unsigned int>::iterator it = fd_mappings.find(fd); if (it == fd_mappings.end()) { - ServerInstance->Logs->Log("SOCKET",DEBUG,"DelFd() on unknown fd: %d", fd); + ServerInstance->Logs->Log("SOCKET",LOG_DEBUG,"DelFd() on unknown fd: %d", fd); return; } @@ -223,7 +223,7 @@ void PollEngine::DelFd(EventHandler* eh) CurrentSetSize--; - ServerInstance->Logs->Log("SOCKET", DEBUG, "Remove file descriptor: %d (index: %d) " + ServerInstance->Logs->Log("SOCKET", LOG_DEBUG, "Remove file descriptor: %d (index: %d) " "(Filled gap with: %d (index: %d))", fd, index, last_fd, last_index); } diff --git a/src/socketengines/socketengine_ports.cpp b/src/socketengines/socketengine_ports.cpp index 58d069886..42bd865c1 100644 --- a/src/socketengines/socketengine_ports.cpp +++ b/src/socketengines/socketengine_ports.cpp @@ -74,7 +74,7 @@ PortsEngine::PortsEngine() } else { - ServerInstance->Logs->Log("SOCKET", DEFAULT, "ERROR: Can't determine maximum number of open sockets!"); + ServerInstance->Logs->Log("SOCKET", LOG_DEFAULT, "ERROR: Can't determine maximum number of open sockets!"); std::cout << "ERROR: Can't determine maximum number of open sockets!" << std::endl; ServerInstance->Exit(EXIT_STATUS_SOCKETENGINE); } @@ -82,8 +82,8 @@ PortsEngine::PortsEngine() if (EngineHandle == -1) { - 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."); + ServerInstance->Logs->Log("SOCKET",LOG_SPARSE,"ERROR: Could not initialize socket engine: %s", strerror(errno)); + ServerInstance->Logs->Log("SOCKET",LOG_SPARSE,"ERROR: This is a fatal error, exiting now."); std::cout << "ERROR: Could not initialize socket engine: " << strerror(errno) << std::endl; std::cout << "ERROR: This is a fatal error, exiting now." << std::endl; ServerInstance->Exit(EXIT_STATUS_SOCKETENGINE); @@ -125,7 +125,7 @@ bool PortsEngine::AddFd(EventHandler* eh, int event_mask) SocketEngine::SetEventMask(eh, event_mask); port_associate(EngineHandle, PORT_SOURCE_FD, fd, mask_to_events(event_mask), eh); - ServerInstance->Logs->Log("SOCKET",DEBUG,"New file descriptor: %d", fd); + ServerInstance->Logs->Log("SOCKET",LOG_DEBUG,"New file descriptor: %d", fd); CurrentSetSize++; return true; } @@ -147,7 +147,7 @@ void PortsEngine::DelFd(EventHandler* eh) CurrentSetSize--; ref[fd] = NULL; - ServerInstance->Logs->Log("SOCKET",DEBUG,"Remove file descriptor: %d", fd); + ServerInstance->Logs->Log("SOCKET",LOG_DEBUG,"Remove file descriptor: %d", fd); } int PortsEngine::DispatchEvents() diff --git a/src/socketengines/socketengine_select.cpp b/src/socketengines/socketengine_select.cpp index 02ab077ca..b721a6b0a 100644 --- a/src/socketengines/socketengine_select.cpp +++ b/src/socketengines/socketengine_select.cpp @@ -84,7 +84,7 @@ bool SelectEngine::AddFd(EventHandler* eh, int event_mask) CurrentSetSize++; - ServerInstance->Logs->Log("SOCKET",DEBUG,"New file descriptor: %d", fd); + ServerInstance->Logs->Log("SOCKET",LOG_DEBUG,"New file descriptor: %d", fd); return true; } @@ -104,7 +104,7 @@ void SelectEngine::DelFd(EventHandler* eh) if (fd == MaxFD) --MaxFD; - ServerInstance->Logs->Log("SOCKET",DEBUG,"Remove file descriptor: %d", fd); + ServerInstance->Logs->Log("SOCKET",LOG_DEBUG,"Remove file descriptor: %d", fd); } void SelectEngine::OnSetEvent(EventHandler* eh, int old_mask, int new_mask) diff --git a/src/user_resolver.cpp b/src/user_resolver.cpp index 1f88018c6..9c530506d 100644 --- a/src/user_resolver.cpp +++ b/src/user_resolver.cpp @@ -31,11 +31,11 @@ void UserResolver::OnLookupComplete(const std::string &result, unsigned int ttl, LocalUser* bound_user = (LocalUser*)ServerInstance->FindUUID(uuid); if (!bound_user) { - ServerInstance->Logs->Log("RESOLVER", DEBUG, "Resolution finished for user '%s' who is gone", uuid.c_str()); + ServerInstance->Logs->Log("RESOLVER", LOG_DEBUG, "Resolution finished for user '%s' who is gone", uuid.c_str()); return; } - ServerInstance->Logs->Log("RESOLVER", DEBUG, "DNS result for %s: '%s' -> '%s'", uuid.c_str(), input.c_str(), result.c_str()); + ServerInstance->Logs->Log("RESOLVER", LOG_DEBUG, "DNS result for %s: '%s' -> '%s'", uuid.c_str(), input.c_str(), result.c_str()); if (!fwd) { @@ -62,7 +62,7 @@ void UserResolver::OnLookupComplete(const std::string &result, unsigned int ttl, } catch (CoreException& e) { - ServerInstance->Logs->Log("RESOLVER", DEBUG,"Error in resolver: %s",e.GetReason()); + ServerInstance->Logs->Log("RESOLVER", LOG_DEBUG,"Error in resolver: %s",e.GetReason()); } } else diff --git a/src/usermanager.cpp b/src/usermanager.cpp index 2d9c3f281..abd450b11 100644 --- a/src/usermanager.cpp +++ b/src/usermanager.cpp @@ -37,7 +37,7 @@ void UserManager::AddUser(int socket, ListenSocket* via, irc::sockets::sockaddrs } catch (...) { - ServerInstance->Logs->Log("USERS", DEFAULT,"*** WTF *** Duplicated UUID! -- Crack smoking monkeys have been unleashed."); + ServerInstance->Logs->Log("USERS", LOG_DEFAULT,"*** WTF *** Duplicated UUID! -- Crack smoking monkeys have been unleashed."); ServerInstance->SNO->WriteToSnoMask('a', "WARNING *** Duplicate UUID allocated!"); return; } @@ -54,11 +54,11 @@ void UserManager::AddUser(int socket, ListenSocket* via, irc::sockets::sockaddrs } catch (CoreException& modexcept) { - ServerInstance->Logs->Log("SOCKET", DEBUG,"%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason()); + ServerInstance->Logs->Log("SOCKET", LOG_DEBUG,"%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason()); } } - ServerInstance->Logs->Log("USERS", DEBUG,"New user fd: %d", socket); + ServerInstance->Logs->Log("USERS", LOG_DEBUG,"New user fd: %d", socket); this->unregistered_count++; @@ -108,7 +108,7 @@ void UserManager::AddUser(int socket, ListenSocket* via, irc::sockets::sockaddrs if (!b->Type.empty() && !New->exempt) { /* user banned */ - ServerInstance->Logs->Log("BANCACHE", DEBUG, "BanCache: Positive hit for " + New->GetIPString()); + ServerInstance->Logs->Log("BANCACHE", LOG_DEBUG, "BanCache: Positive hit for " + New->GetIPString()); if (!ServerInstance->Config->MoronBanner.empty()) New->WriteServ("NOTICE %s :*** %s", New->nick.c_str(), ServerInstance->Config->MoronBanner.c_str()); this->QuitUser(New, b->Reason); @@ -116,7 +116,7 @@ void UserManager::AddUser(int socket, ListenSocket* via, irc::sockets::sockaddrs } else { - ServerInstance->Logs->Log("BANCACHE", DEBUG, "BanCache: Negative hit for " + New->GetIPString()); + ServerInstance->Logs->Log("BANCACHE", LOG_DEBUG, "BanCache: Negative hit for " + New->GetIPString()); } } else @@ -135,7 +135,7 @@ void UserManager::AddUser(int socket, ListenSocket* via, irc::sockets::sockaddrs if (!ServerInstance->SE->AddFd(eh, FD_WANT_FAST_READ | FD_WANT_EDGE_WRITE)) { - ServerInstance->Logs->Log("USERS", DEBUG,"Internal error on new connection"); + ServerInstance->Logs->Log("USERS", LOG_DEBUG,"Internal error on new connection"); this->QuitUser(New, "Internal error handling connection"); } @@ -167,19 +167,19 @@ void UserManager::QuitUser(User *user, const std::string &quitreason, const char { if (user->quitting) { - ServerInstance->Logs->Log("CULLLIST",DEBUG, "*** Warning *** - You tried to quit a user (%s) twice. Did your module call QuitUser twice?", user->nick.c_str()); + ServerInstance->Logs->Log("CULLLIST",LOG_DEBUG, "*** Warning *** - You tried to quit a user (%s) twice. Did your module call QuitUser twice?", user->nick.c_str()); return; } if (IS_SERVER(user)) { - ServerInstance->Logs->Log("CULLLIST",DEBUG, "*** Warning *** - You tried to quit a fake user (%s)", user->nick.c_str()); + ServerInstance->Logs->Log("CULLLIST",LOG_DEBUG, "*** Warning *** - You tried to quit a fake user (%s)", user->nick.c_str()); return; } user->quitting = true; - ServerInstance->Logs->Log("USERS", DEBUG, "QuitUser: %s=%s '%s'", user->uuid.c_str(), user->nick.c_str(), quitreason.c_str()); + ServerInstance->Logs->Log("USERS", LOG_DEBUG, "QuitUser: %s=%s '%s'", user->uuid.c_str(), user->nick.c_str(), quitreason.c_str()); user->Write("ERROR :Closing link: (%s@%s) [%s]", user->ident.c_str(), user->host.c_str(), *operreason ? operreason : quitreason.c_str()); std::string reason; @@ -238,7 +238,7 @@ void UserManager::QuitUser(User *user, const std::string &quitreason, const char if (iter != this->clientlist->end()) this->clientlist->erase(iter); else - ServerInstance->Logs->Log("USERS", DEBUG, "iter == clientlist->end, can't remove them from hash... problematic.."); + ServerInstance->Logs->Log("USERS", LOG_DEBUG, "iter == clientlist->end, can't remove them from hash... problematic.."); ServerInstance->Users->uuidlist->erase(user->uuid); } diff --git a/src/users.cpp b/src/users.cpp index cd3dcb8a6..fb7c46d6b 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -122,7 +122,7 @@ void LocalUser::StartDNSLookup() } catch (CoreException& e) { - ServerInstance->Logs->Log("USERS", DEBUG,"Error in resolver: %s",e.GetReason()); + ServerInstance->Logs->Log("USERS", LOG_DEBUG,"Error in resolver: %s",e.GetReason()); dns_done = true; ServerInstance->stats->statsDnsBad++; } @@ -205,7 +205,7 @@ User::User(const std::string &uid, const std::string& sid, int type) quietquit = quitting = false; client_sa.sa.sa_family = AF_UNSPEC; - ServerInstance->Logs->Log("USERS", DEBUG, "New UUID for user: %s", uuid.c_str()); + ServerInstance->Logs->Log("USERS", LOG_DEBUG, "New UUID for user: %s", uuid.c_str()); user_hash::iterator finduuid = ServerInstance->Users->uuidlist->find(uuid); if (finduuid == ServerInstance->Users->uuidlist->end()) @@ -233,7 +233,7 @@ LocalUser::LocalUser(int myfd, irc::sockets::sockaddrs* client, irc::sockets::so User::~User() { if (ServerInstance->Users->uuidlist->find(uuid) != ServerInstance->Users->uuidlist->end()) - ServerInstance->Logs->Log("USERS", DEFAULT, "User destructor for %s called without cull", uuid.c_str()); + ServerInstance->Logs->Log("USERS", LOG_DEFAULT, "User destructor for %s called without cull", uuid.c_str()); } const std::string& User::MakeHost() @@ -588,7 +588,7 @@ void User::Oper(OperInfo* info) nick.c_str(), ident.c_str(), host.c_str(), oper->NameStr(), opername.c_str()); this->WriteNumeric(381, "%s :You are now %s %s", nick.c_str(), strchr("aeiouAEIOU", oper->name[0]) ? "an" : "a", oper->NameStr()); - ServerInstance->Logs->Log("OPER", DEFAULT, "%s opered as type: %s", GetFullRealHost().c_str(), oper->NameStr()); + ServerInstance->Logs->Log("OPER", LOG_DEFAULT, "%s opered as type: %s", GetFullRealHost().c_str(), oper->NameStr()); ServerInstance->Users->all_opers.push_back(this); // Expand permissions from config for faster lookup @@ -807,7 +807,7 @@ void LocalUser::FullConnect() ServerInstance->SNO->WriteToSnoMask('c',"Client connecting on port %d (class %s): %s (%s) [%s]", this->GetServerPort(), this->MyClass->name.c_str(), GetFullRealHost().c_str(), this->GetIPString().c_str(), this->fullname.c_str()); - ServerInstance->Logs->Log("BANCACHE", DEBUG, "BanCache: Adding NEGATIVE hit for " + this->GetIPString()); + ServerInstance->Logs->Log("BANCACHE", LOG_DEBUG, "BanCache: Adding NEGATIVE hit for " + this->GetIPString()); ServerInstance->BanCache->AddHit(this->GetIPString(), "", ""); // reset the flood penalty (which could have been raised due to things like auto +x) CommandFloodPenalty = 0; @@ -1032,7 +1032,7 @@ void LocalUser::Write(const std::string& text) return; } - ServerInstance->Logs->Log("USEROUTPUT", RAWIO, "C[%s] O %s", uuid.c_str(), text.c_str()); + ServerInstance->Logs->Log("USEROUTPUT", LOG_RAWIO, "C[%s] O %s", uuid.c_str(), text.c_str()); eh.AddWriteBuf(text); eh.AddWriteBuf(wide_newline); @@ -1511,7 +1511,7 @@ void LocalUser::SetClass(const std::string &explicit_name) { ConnectClass *found = NULL; - ServerInstance->Logs->Log("CONNECTCLASS", DEBUG, "Setting connect class for UID %s", this->uuid.c_str()); + ServerInstance->Logs->Log("CONNECTCLASS", LOG_DEBUG, "Setting connect class for UID %s", this->uuid.c_str()); if (!explicit_name.empty()) { @@ -1521,7 +1521,7 @@ void LocalUser::SetClass(const std::string &explicit_name) if (explicit_name == c->name) { - ServerInstance->Logs->Log("CONNECTCLASS", DEBUG, "Explicitly set to %s", explicit_name.c_str()); + ServerInstance->Logs->Log("CONNECTCLASS", LOG_DEBUG, "Explicitly set to %s", explicit_name.c_str()); found = c; } } @@ -1531,7 +1531,7 @@ void LocalUser::SetClass(const std::string &explicit_name) for (ClassVector::iterator i = ServerInstance->Config->Classes.begin(); i != ServerInstance->Config->Classes.end(); i++) { ConnectClass* c = *i; - ServerInstance->Logs->Log("CONNECTCLASS", DEBUG, "Checking %s", c->GetName().c_str()); + ServerInstance->Logs->Log("CONNECTCLASS", LOG_DEBUG, "Checking %s", c->GetName().c_str()); ModResult MOD_RESULT; FIRST_MOD_RESULT(OnSetConnectClass, MOD_RESULT, (this,c)); @@ -1539,7 +1539,7 @@ void LocalUser::SetClass(const std::string &explicit_name) continue; if (MOD_RESULT == MOD_RES_ALLOW) { - ServerInstance->Logs->Log("CONNECTCLASS", DEBUG, "Class forced by module to %s", c->GetName().c_str()); + ServerInstance->Logs->Log("CONNECTCLASS", LOG_DEBUG, "Class forced by module to %s", c->GetName().c_str()); found = c; break; } @@ -1555,7 +1555,7 @@ void LocalUser::SetClass(const std::string &explicit_name) if (!InspIRCd::MatchCIDR(this->GetIPString(), c->GetHost(), NULL) && !InspIRCd::MatchCIDR(this->host, c->GetHost(), NULL)) { - ServerInstance->Logs->Log("CONNECTCLASS", DEBUG, "No host match (for %s)", c->GetHost().c_str()); + ServerInstance->Logs->Log("CONNECTCLASS", LOG_DEBUG, "No host match (for %s)", c->GetHost().c_str()); continue; } @@ -1565,7 +1565,7 @@ void LocalUser::SetClass(const std::string &explicit_name) */ if (c->limit && (c->GetReferenceCount() >= c->limit)) { - ServerInstance->Logs->Log("CONNECTCLASS", DEBUG, "OOPS: Connect class limit (%lu) hit, denying", c->limit); + ServerInstance->Logs->Log("CONNECTCLASS", LOG_DEBUG, "OOPS: Connect class limit (%lu) hit, denying", c->limit); continue; } @@ -1573,7 +1573,7 @@ void LocalUser::SetClass(const std::string &explicit_name) int port = c->config->getInt("port"); if (port) { - ServerInstance->Logs->Log("CONNECTCLASS", DEBUG, "Requires port (%d)", port); + ServerInstance->Logs->Log("CONNECTCLASS", LOG_DEBUG, "Requires port (%d)", port); /* and our port doesn't match, fail. */ if (this->GetServerPort() != port) @@ -1584,7 +1584,7 @@ void LocalUser::SetClass(const std::string &explicit_name) { if (ServerInstance->PassCompare(this, c->config->getString("password"), password, c->config->getString("hash"))) { - ServerInstance->Logs->Log("CONNECTCLASS", DEBUG, "Bad password, skipping"); + ServerInstance->Logs->Log("CONNECTCLASS", LOG_DEBUG, "Bad password, skipping"); continue; } } diff --git a/src/xline.cpp b/src/xline.cpp index 2fdf71b17..f50348c3c 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -544,7 +544,7 @@ void XLine::DefaultApply(User* u, const std::string &line, bool bancache) if (bancache) { - ServerInstance->Logs->Log("BANCACHE", DEBUG, "BanCache: Adding positive hit (" + line + ") for " + u->GetIPString()); + ServerInstance->Logs->Log("BANCACHE", LOG_DEBUG, "BanCache: Adding positive hit (" + line + ") for " + u->GetIPString()); ServerInstance->BanCache->AddHit(u->GetIPString(), this->type, line + "-Lined: " + this->reason, this->duration); } } |