From abc57eddfb56462ac3e433601d010abf1942e611 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Sun, 7 Jul 2013 20:01:44 +0100 Subject: Change modules to use the MODNAME constant when logging. The majority of modules were logging with their module name as the log type. There was a few places which were logging to a non-name type but, with the exception of CONFIG, those messages are so uncommon that it doesn't make sense to use a seperate type for them. --- src/modules/m_spanningtree/compat.cpp | 6 +++--- src/modules/m_spanningtree/fjoin.cpp | 2 +- src/modules/m_spanningtree/fmode.cpp | 2 +- src/modules/m_spanningtree/hmac.cpp | 2 +- src/modules/m_spanningtree/ijoin.cpp | 12 ++++++------ src/modules/m_spanningtree/main.cpp | 2 +- src/modules/m_spanningtree/override_map.cpp | 2 +- src/modules/m_spanningtree/postcommand.cpp | 4 ++-- src/modules/m_spanningtree/resolvers.cpp | 2 +- src/modules/m_spanningtree/server.cpp | 2 +- src/modules/m_spanningtree/treeserver.cpp | 2 +- src/modules/m_spanningtree/treesocket1.cpp | 4 ++-- src/modules/m_spanningtree/treesocket2.cpp | 12 ++++++------ src/modules/m_spanningtree/uid.cpp | 6 +++--- src/modules/m_spanningtree/utils.cpp | 6 +++--- 15 files changed, 33 insertions(+), 33 deletions(-) (limited to 'src/modules/m_spanningtree') diff --git a/src/modules/m_spanningtree/compat.cpp b/src/modules/m_spanningtree/compat.cpp index ad3a5fee8..41cabbc93 100644 --- a/src/modules/m_spanningtree/compat.cpp +++ b/src/modules/m_spanningtree/compat.cpp @@ -30,7 +30,7 @@ void TreeSocket::WriteLine(std::string line) { if (line[0] != ':') { - ServerInstance->Logs->Log("m_spanningtree", LOG_DEFAULT, "Sending line without server prefix!"); + ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Sending line without server prefix!"); line = ":" + ServerInstance->Config->GetSID() + " " + line; } if (proto_version != ProtocolVersion) @@ -157,7 +157,7 @@ void TreeSocket::WriteLine(std::string line) } } - ServerInstance->Logs->Log("m_spanningtree", LOG_RAWIO, "S[%d] O %s", this->GetFd(), line.c_str()); + ServerInstance->Logs->Log(MODNAME, LOG_RAWIO, "S[%d] O %s", this->GetFd(), line.c_str()); this->WriteData(line); this->WriteData(newline); } @@ -212,7 +212,7 @@ bool TreeSocket::PreProcessOldProtocolMessage(User*& who, std::string& cmd, std: if (!server) { // We've no idea what this is, log and stop processing - ServerInstance->Logs->Log("m_spanningtree", LOG_DEFAULT, "Received a " + cmd + " with an unknown target: \"" + params[0] + "\", command dropped"); + ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Received a " + cmd + " with an unknown target: \"" + params[0] + "\", command dropped"); return false; } diff --git a/src/modules/m_spanningtree/fjoin.cpp b/src/modules/m_spanningtree/fjoin.cpp index faf534542..37683a440 100644 --- a/src/modules/m_spanningtree/fjoin.cpp +++ b/src/modules/m_spanningtree/fjoin.cpp @@ -73,7 +73,7 @@ CmdResult CommandFJoin::Handle(const std::vector& params, User *src time_t TS = ConvToInt(params[1]); if (!TS) { - 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->Logs->Log(MODNAME, 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; } diff --git a/src/modules/m_spanningtree/fmode.cpp b/src/modules/m_spanningtree/fmode.cpp index 9a72c5f05..7e02df6a7 100644 --- a/src/modules/m_spanningtree/fmode.cpp +++ b/src/modules/m_spanningtree/fmode.cpp @@ -27,7 +27,7 @@ CmdResult CommandFMode::Handle(const std::vector& params, User *who time_t TS = ConvToInt(params[1]); if (!TS) { - 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?. Dropping link."); + ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "*** BUG? *** TS of 0 sent to FMODE. Are some services authors smoking craq, or is it 1970 again?. Dropping link."); ServerInstance->SNO->WriteToSnoMask('d', "WARNING: The server %s is sending FMODE with a TS of zero. Total craq, dropping link.", who->server.c_str()); return CMD_INVALID; } diff --git a/src/modules/m_spanningtree/hmac.cpp b/src/modules/m_spanningtree/hmac.cpp index 0b96f9b26..d79f13567 100644 --- a/src/modules/m_spanningtree/hmac.cpp +++ b/src/modules/m_spanningtree/hmac.cpp @@ -59,7 +59,7 @@ std::string TreeSocket::MakePass(const std::string &password, const std::string return "AUTH:" + BinToBase64(sha256->hmac(password, challenge)); if (!challenge.empty() && !sha256) - ServerInstance->Logs->Log("m_spanningtree", LOG_DEFAULT, "Not authenticating to server using SHA256/HMAC because we don't have m_sha256 loaded!"); + ServerInstance->Logs->Log(MODNAME, 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/ijoin.cpp b/src/modules/m_spanningtree/ijoin.cpp index 2f71ffe27..ce4f4668b 100644 --- a/src/modules/m_spanningtree/ijoin.cpp +++ b/src/modules/m_spanningtree/ijoin.cpp @@ -30,7 +30,7 @@ CmdResult CommandIJoin::HandleRemote(const std::vector& params, Rem { // Desync detected, recover // Ignore the join and send RESYNC, this will result in the remote server sending all channel data to us - ServerInstance->Logs->Log("m_spanningtree", LOG_DEBUG, "Received IJOIN for non-existant channel: " + params[0]); + ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Received IJOIN for non-existant channel: " + params[0]); parameterlist p; p.push_back(params[0]); @@ -46,13 +46,13 @@ CmdResult CommandIJoin::HandleRemote(const std::vector& params, Rem time_t RemoteTS = ConvToInt(params[1]); if (!RemoteTS) { - ServerInstance->Logs->Log("m_spanningtree", LOG_DEFAULT, "Invalid TS in IJOIN: " + params[1]); + ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Invalid TS in IJOIN: " + params[1]); return CMD_INVALID; } if (RemoteTS < chan->age) { - ServerInstance->Logs->Log("m_spanningtree", LOG_DEFAULT, "Attempted to lower TS via IJOIN. Channel=" + params[0] + " RemoteTS=" + params[1] + " LocalTS=" + ConvToStr(chan->age)); + ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Attempted to lower TS via IJOIN. Channel=" + params[0] + " RemoteTS=" + params[1] + " LocalTS=" + ConvToStr(chan->age)); return CMD_INVALID; } apply_modes = ((params.size() > 2) && (RemoteTS == chan->age)); @@ -66,12 +66,12 @@ CmdResult CommandIJoin::HandleRemote(const std::vector& params, Rem CmdResult CommandResync::HandleServer(const std::vector& params, FakeUser* user) { - ServerInstance->Logs->Log("m_spanningtree", LOG_DEBUG, "Resyncing " + params[0]); + ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Resyncing " + params[0]); Channel* chan = ServerInstance->FindChan(params[0]); if (!chan) { // This can happen for a number of reasons, safe to ignore - ServerInstance->Logs->Log("m_spanningtree", LOG_DEBUG, "Channel does not exist"); + ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Channel does not exist"); return CMD_FAILURE; } @@ -83,7 +83,7 @@ CmdResult CommandResync::HandleServer(const std::vector& params, Fa TreeSocket* socket = server->GetSocket(); if (!socket) { - ServerInstance->Logs->Log("m_spanningtree", LOG_DEFAULT, "Received RESYNC with a source that is not directly connected: " + user->uuid); + ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Received RESYNC with a source that is not directly connected: " + user->uuid); return CMD_INVALID; } diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 7cda6a810..3c82d9de0 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -669,7 +669,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", LOG_DEBUG, "called with param %s", parameter.c_str()); + ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "OnPreRehash called with param %s", parameter.c_str()); // Send out to other servers if (!parameter.empty() && parameter[0] != '-') diff --git a/src/modules/m_spanningtree/override_map.cpp b/src/modules/m_spanningtree/override_map.cpp index ba8abecbe..8e2c669c0 100644 --- a/src/modules/m_spanningtree/override_map.cpp +++ b/src/modules/m_spanningtree/override_map.cpp @@ -35,7 +35,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", LOG_DEBUG, "ShowMap depth %d on line %d", depth, line); + ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "ShowMap depth %d on line %d", depth, line); float percent; if (ServerInstance->Users->clientlist->size() == 0) diff --git a/src/modules/m_spanningtree/postcommand.cpp b/src/modules/m_spanningtree/postcommand.cpp index 476453e20..45b3608c6 100644 --- a/src/modules/m_spanningtree/postcommand.cpp +++ b/src/modules/m_spanningtree/postcommand.cpp @@ -54,7 +54,7 @@ void SpanningTreeUtilities::RouteCommand(TreeServer* origin, Command* thiscmd, c TreeServer* sdest = FindServer(routing.serverdest); if (!sdest) { - ServerInstance->Logs->Log("m_spanningtree", LOG_DEFAULT, "Trying to route ENCAP to nonexistant server %s", + ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Trying to route ENCAP to nonexistant server %s", routing.serverdest.c_str()); return; } @@ -69,7 +69,7 @@ void SpanningTreeUtilities::RouteCommand(TreeServer* origin, Command* thiscmd, c if (!(ver.Flags & (VF_COMMON | VF_CORE)) && srcmodule != Creator) { - ServerInstance->Logs->Log("m_spanningtree", LOG_DEFAULT, "Routed command %s from non-VF_COMMON module %s", + ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Routed command %s from non-VF_COMMON module %s", command.c_str(), srcmodule->ModuleSourceFile.c_str()); return; } diff --git a/src/modules/m_spanningtree/resolvers.cpp b/src/modules/m_spanningtree/resolvers.cpp index a7ad97678..03996b438 100644 --- a/src/modules/m_spanningtree/resolvers.cpp +++ b/src/modules/m_spanningtree/resolvers.cpp @@ -123,7 +123,7 @@ void SecurityIPResolver::OnError(const DNS::Query *r) delete res; } } - ServerInstance->Logs->Log("m_spanningtree", LOG_DEFAULT, "Could not resolve IP associated with Link '%s': %s", + ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Could not resolve IP associated with Link '%s': %s", MyLink->Name.c_str(), this->manager->GetErrorStr(r->error).c_str()); } diff --git a/src/modules/m_spanningtree/server.cpp b/src/modules/m_spanningtree/server.cpp index 85204ccaa..49136e39c 100644 --- a/src/modules/m_spanningtree/server.cpp +++ b/src/modules/m_spanningtree/server.cpp @@ -182,7 +182,7 @@ bool TreeSocket::CheckDuplicate(const std::string& sname, const std::string& sid } /* Check for fully initialized instances of the server by id */ - ServerInstance->Logs->Log("m_spanningtree", LOG_DEBUG, "Looking for dupe SID %s", sid.c_str()); + ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Looking for dupe SID %s", sid.c_str()); CheckDupe = Utils->FindServerID(sid); if (CheckDupe) diff --git a/src/modules/m_spanningtree/treeserver.cpp b/src/modules/m_spanningtree/treeserver.cpp index 7b745410d..991f98784 100644 --- a/src/modules/m_spanningtree/treeserver.cpp +++ b/src/modules/m_spanningtree/treeserver.cpp @@ -55,7 +55,7 @@ TreeServer::TreeServer(SpanningTreeUtilities* Util, const std::string& Name, con long ts = ServerInstance->Time() * 1000 + (ServerInstance->Time_ns() / 1000000); this->StartBurst = ts; - ServerInstance->Logs->Log("m_spanningtree", LOG_DEBUG, "Server %s started bursting at time %lu", sid.c_str(), ts); + ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Server %s started bursting at time %lu", sid.c_str(), ts); /* find the 'route' for this server (e.g. the one directly connected * to the local server, which we can use to reach it) diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp index 739b50dba..69dfa3ce3 100644 --- a/src/modules/m_spanningtree/treesocket1.cpp +++ b/src/modules/m_spanningtree/treesocket1.cpp @@ -143,7 +143,7 @@ void TreeSocket::SendError(const std::string &errormessage) */ void TreeSocket::SquitServer(std::string &from, TreeServer* Current, int& num_lost_servers, int& num_lost_users) { - ServerInstance->Logs->Log("m_spanningtree", LOG_DEBUG, "SquitServer for %s from %s", Current->GetName().c_str(), from.c_str()); + ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "SquitServer for %s from %s", Current->GetName().c_str(), from.c_str()); /* recursively squit the servers attached to 'Current'. * We're going backwards so we don't remove users * while we still need them ;) @@ -204,7 +204,7 @@ void TreeSocket::Squit(TreeServer* Current, const std::string &reason) } } else - ServerInstance->Logs->Log("m_spanningtree", LOG_DEFAULT, "Squit from unknown server"); + ServerInstance->Logs->Log(MODNAME, 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 328bb3c72..070c003cc 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -80,7 +80,7 @@ void TreeSocket::ProcessLine(std::string &line) std::string command; parameterlist params; - ServerInstance->Logs->Log("m_spanningtree", LOG_RAWIO, "S[%d] I %s", this->GetFd(), line.c_str()); + ServerInstance->Logs->Log(MODNAME, LOG_RAWIO, "S[%d] I %s", this->GetFd(), line.c_str()); Split(line, prefix, command, params); @@ -267,7 +267,7 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command, } else { - ServerInstance->Logs->Log("m_spanningtree", LOG_DEBUG, "Command '%s' from unknown prefix '%s'! Dropping entire command.", + ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Command '%s' from unknown prefix '%s'! Dropping entire command.", command.c_str(), prefix.c_str()); return; } @@ -298,7 +298,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", LOG_DEBUG, "Protocol violation: Fake direction '%s' from connection '%s'", + ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Protocol violation: Fake direction '%s' from connection '%s'", prefix.c_str(),linkID.c_str()); return; } @@ -467,7 +467,7 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command, if (!cmd) { irc::stringjoiner pmlist(params); - ServerInstance->Logs->Log("m_spanningtree", LOG_SPARSE, "Unrecognised S2S command :%s %s %s", + ServerInstance->Logs->Log(MODNAME, 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; @@ -476,7 +476,7 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command, if (params.size() < cmd->min_params) { irc::stringjoiner pmlist(params); - ServerInstance->Logs->Log("m_spanningtree", LOG_SPARSE, "Insufficient parameters for S2S command :%s %s %s", + ServerInstance->Logs->Log(MODNAME, 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; @@ -495,7 +495,7 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command, if (res == CMD_INVALID) { irc::stringjoiner pmlist(params); - ServerInstance->Logs->Log("m_spanningtree", LOG_SPARSE, "Error handling S2S command :%s %s %s", + ServerInstance->Logs->Log(MODNAME, 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 2eb7f90e4..4204737ca 100644 --- a/src/modules/m_spanningtree/uid.cpp +++ b/src/modules/m_spanningtree/uid.cpp @@ -62,7 +62,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", LOG_DEBUG, "*** Collision on %s, collide=%d", params[2].c_str(), collide); + ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "*** Collision on %s, collide=%d", params[2].c_str(), collide); if (collide != 1) { @@ -85,7 +85,7 @@ CmdResult CommandUID::Handle(const parameterlist ¶ms, User* serversrc) } catch (...) { - ServerInstance->Logs->Log("m_spanningtree", LOG_DEFAULT, "Duplicate UUID %s in client introduction", params[0].c_str()); + ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Duplicate UUID %s in client introduction", params[0].c_str()); return CMD_INVALID; } (*(ServerInstance->Users->clientlist))[params[2]] = _new; @@ -110,7 +110,7 @@ CmdResult CommandUID::Handle(const parameterlist ¶ms, User* serversrc) ModeHandler* mh = ServerInstance->Modes->FindMode(*v, MODETYPE_USER); if (!mh) { - ServerInstance->Logs->Log("m_spanningtree", LOG_DEFAULT, "Unrecognised mode '%c' for a user in UID, dropping link", *v); + ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Unrecognised mode '%c' for a user in UID, dropping link", *v); return CMD_INVALID; } diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp index bbaa9bb60..9739cfafb 100644 --- a/src/modules/m_spanningtree/utils.cpp +++ b/src/modules/m_spanningtree/utils.cpp @@ -274,7 +274,7 @@ void SpanningTreeUtilities::RefreshIPCache() Link* L = *i; if (!L->Port) { - ServerInstance->Logs->Log("m_spanningtree", LOG_DEFAULT, "m_spanningtree: Ignoring a link block without a port."); + ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "m_spanningtree: Ignoring a link block without a port."); /* Invalid link block */ continue; } @@ -365,11 +365,11 @@ void SpanningTreeUtilities::ReadConfiguration() if (L->IPAddr.empty()) { L->IPAddr = "*"; - 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."); + ServerInstance->Logs->Log(MODNAME, 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", LOG_DEFAULT, "Configuration warning: Link block '" + assign(L->Name) + "' has no port defined, you will not be able to /connect it."); + ServerInstance->Logs->Log(MODNAME, 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); -- cgit v1.2.3