diff options
author | Adam <Adam@anope.org> | 2017-01-23 12:35:14 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2017-01-23 12:35:14 -0500 |
commit | 16ca76c2e7ab287e480185fbb03a0bb438351eda (patch) | |
tree | dfb25534afa2352b65b2ee707086cb5eecc96fbb /modules/protocol/rfc1459.cpp | |
parent | ff030c1eb7c3764f9add2a689479e84d616cabcb (diff) |
Make log system use newer format strings
Also allow log messages to be translatable
Diffstat (limited to 'modules/protocol/rfc1459.cpp')
-rw-r--r-- | modules/protocol/rfc1459.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/modules/protocol/rfc1459.cpp b/modules/protocol/rfc1459.cpp index 1405e121e..d1ac3eeaf 100644 --- a/modules/protocol/rfc1459.cpp +++ b/modules/protocol/rfc1459.cpp @@ -165,14 +165,15 @@ void senders::Wallops::Send(const MessageSource &source, const Anope::string &ms void Away::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { + User *u = source.GetUser(); const Anope::string &msg = !params.empty() ? params[0] : ""; - EventManager::Get()->Dispatch(&Event::UserAway::OnUserAway, source.GetUser(), msg); + EventManager::Get()->Dispatch(&Event::UserAway::OnUserAway, u, msg); if (!msg.empty()) - Log(source.GetUser(), "away") << "is now away: " << msg; + u->logger.Category("away").Log(_("{0} is now away: {1}"), u->GetMask(), msg); else - Log(source.GetUser(), "away") << "is no longer away"; + u->logger.Category("away").Log(_("{0} is no longer away"), u->GetMask()); } void Capab::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) @@ -191,7 +192,7 @@ void Capab::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) void Error::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { - Log(LOG_TERMINAL) << "ERROR: " << params[0]; + Anope::Logger.Terminal("ERROR: {0}", params[0]); Anope::QuitReason = "Received ERROR from uplink: " + params[0]; Anope::Quitting = true; } @@ -430,7 +431,7 @@ void Part::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) if (!c || !u->FindChannel(c)) continue; - Log(u, c, "part") << "Reason: " << (!reason.empty() ? reason : "No reason"); + c->logger.User(u).Category("part").Log(_("{0} parted {1}: {2}"), u->GetMask(), c->GetName(), !reason.empty() ? reason : "No reason"); EventManager::Get()->Dispatch(&Event::PrePartChannel::OnPrePartChannel, u, c); c->DeleteUser(u); @@ -478,7 +479,7 @@ void Privmsg::Run(MessageSource &source, const std::vector<Anope::string> ¶m ServiceBot *bi = ServiceBot::Find(receiver); if (!bi) return; - Log(LOG_DEBUG) << "Ignored PRIVMSG without @ from " << u->nick; + bi->logger.Debug("Ignored PRIVMSG without @ from {0}", u->nick); u->SendMessage(bi, _("\"/msg %s\" is no longer supported. Use \"/msg %s@%s\" or \"/%s\" instead."), bi->nick.c_str(), bi->nick.c_str(), Me->GetName().c_str(), bi->nick.c_str()); return; } @@ -518,7 +519,7 @@ void Quit::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) const Anope::string &reason = params[0]; User *user = source.GetUser(); - Log(user, "quit") << "quit (Reason: " << (!reason.empty() ? reason : "no reason") << ")"; + user->logger.Category("quit").Log(_("{0} quit: {1}"), user->GetMask(), (!reason.empty() ? reason : "no reason")); user->Quit(reason); } @@ -529,7 +530,7 @@ void SQuit::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) if (!s) { - Log(LOG_DEBUG) << "SQUIT for nonexistent server " << params[0]; + Anope::Logger.Debug("SQUIT for nonexistent server {0}", params[0]); return; } |