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 | |
| parent | ff030c1eb7c3764f9add2a689479e84d616cabcb (diff) | |
Make log system use newer format strings
Also allow log messages to be translatable
Diffstat (limited to 'modules')
127 files changed, 858 insertions, 605 deletions
diff --git a/modules/botserv/assign.cpp b/modules/botserv/assign.cpp index eca103e9f..db368c75e 100644 --- a/modules/botserv/assign.cpp +++ b/modules/botserv/assign.cpp @@ -80,7 +80,7 @@ class CommandBSAssign : public Command } bool override = !access.HasPriv("ASSIGN"); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "for " << bi->nick; + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to assign {0}"), bi->nick); bi->Assign(source.GetUser(), ci); source.Reply(_("Bot \002{0}\002 has been assigned to \002{1}\002."), bi->nick, ci->GetName()); @@ -147,7 +147,7 @@ class CommandBSUnassign : public Command } bool override = !access.HasPriv("ASSIGN"); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "for " << ci->GetBot()->nick; + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to unassign {0}"), ci->GetBot()->nick); ServiceBot *bi = ci->GetBot(); bi->UnAssign(source.GetUser(), ci); @@ -192,7 +192,7 @@ class CommandBSSetNoBot : public Command if (value.equals_ci("ON")) { - Log(LOG_ADMIN, source, this, ci) << "to enable nobot"; + logger.Command(LogType::ADMIN, source, ci, _("{source} used {command} on {channel} to enable nobot")); ci->SetS<bool>("BS_NOBOT", true); if (ci->GetBot()) @@ -201,7 +201,7 @@ class CommandBSSetNoBot : public Command } else if (value.equals_ci("OFF")) { - Log(LOG_ADMIN, source, this, ci) << "to disable nobot"; + logger.Command(LogType::ADMIN, source, ci, _("{source} used {command} on {channel} to disable nobot")); ci->UnsetS<bool>("BS_NOBOT"); source.Reply(_("No-bot mode is now \002off\002 for \002{0}\002."), ci->GetName()); diff --git a/modules/botserv/autoassign.cpp b/modules/botserv/autoassign.cpp index 3bb6dce64..861d97f6f 100644 --- a/modules/botserv/autoassign.cpp +++ b/modules/botserv/autoassign.cpp @@ -37,7 +37,7 @@ class BSAutoAssign : public Module ServiceBot *bi = ServiceBot::Find(bot, true); if (bi == NULL) { - Log(this) << "bs_autoassign is configured to assign bot " << bot << ", but it does not exist?"; + logger.Log("bs_autoassign is configured to assign bot {0}, but it does not exist?", bot); return; } diff --git a/modules/botserv/badwords.cpp b/modules/botserv/badwords.cpp index 754e202a7..071414ac4 100644 --- a/modules/botserv/badwords.cpp +++ b/modules/botserv/badwords.cpp @@ -144,9 +144,9 @@ class CommandBSBadwords : public Command void DoList(CommandSource &source, ChanServ::Channel *ci, const Anope::string &word) { bool override = !source.AccessFor(ci).HasPriv("BADWORDS"); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "LIST"; - ListFormatter list(source.GetAccount()); + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to list badwords")); + ListFormatter list(source.GetAccount()); list.AddColumn(_("Number")).AddColumn(_("Word")).AddColumn(_("Type")); if (!badwords->GetBadWordCount(ci)) @@ -244,7 +244,7 @@ class CommandBSBadwords : public Command } bool override = !source.AccessFor(ci).HasPriv("BADWORDS"); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "ADD " << realword; + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to add {0}"), realword); badwords->AddBadWord(ci, realword, bwtype); source.Reply(_("\002{0}\002 added to \002{1}\002 bad words list."), realword, ci->GetName()); @@ -271,7 +271,8 @@ class CommandBSBadwords : public Command if (!num || num > badwords->GetBadWordCount(ci)) return; - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "DEL " << badwords->GetBadWord(ci, num - 1)->GetWord(); + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to remove {0}"), badwords->GetBadWord(ci, num - 1)->GetWord()); + ++deleted; badwords->EraseBadWord(ci, num - 1); }, @@ -304,7 +305,7 @@ class CommandBSBadwords : public Command return; } - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "DEL " << bw->GetWord(); + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to remove {3}"), bw->GetWord()); source.Reply(_("\002{0}\002 deleted from \002{1}\002 bad words list."), bw->GetWord(), ci->GetName()); @@ -315,7 +316,7 @@ class CommandBSBadwords : public Command void DoClear(CommandSource &source, ChanServ::Channel *ci) { bool override = !source.AccessFor(ci).HasPriv("BADWORDS"); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "CLEAR"; + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to clear the badwords list")); badwords->ClearBadWords(ci); source.Reply(_("Bad words list is now empty.")); diff --git a/modules/botserv/bot.cpp b/modules/botserv/bot.cpp index 082bd6337..4eb5d2069 100644 --- a/modules/botserv/bot.cpp +++ b/modules/botserv/bot.cpp @@ -103,7 +103,7 @@ class CommandBSBot : public Command bi->bi = botinfo; botinfo->bot = bi; - Log(LOG_ADMIN, source, this) << "ADD " << bi->GetMask() << " " << bi->realname; + logger.Command(LogType::ADMIN, source, _("{source} used {command} to add bot {0} {1}"), bi->GetMask(), bi->realname); source.Reply(_("\002{0}!{1}@{2}\002 (\002{3}\002) added to the bot list."), bi->nick, bi->GetIdent(), bi->host, bi->realname); @@ -266,8 +266,10 @@ class CommandBSBot : public Command if (!user.empty()) bi->OnKill(); + logger.Command(LogType::ADMIN, source, _("{source} used {command} to change bot {0} to {1} {2}"), + oldnick, bi->GetMask(), bi->realname); + source.Reply(_("Bot \002{0}\002 has been changed to \002{1}!{2}@{3}\002 (\002{4}\002)."), oldnick, bi->nick, bi->GetIdent(), bi->host, bi->realname); - Log(LOG_ADMIN, source, this) << "CHANGE " << oldnick << " to " << bi->GetMask() << " " << bi->realname; EventManager::Get()->Dispatch(&Event::BotChange::OnBotChange, bi); } @@ -297,7 +299,7 @@ class CommandBSBot : public Command EventManager::Get()->Dispatch(&Event::BotDelete::OnBotDelete, bi); - Log(LOG_ADMIN, source, this) << "DEL " << bi->nick; + logger.Command(LogType::ADMIN, source, _("{source} used {command} to delete bot {0}"), bi->nick); source.Reply(_("Bot \002{0}\002 has been deleted."), bi->nick); delete bi; diff --git a/modules/botserv/control.cpp b/modules/botserv/control.cpp index 448a28baf..1785e65e9 100644 --- a/modules/botserv/control.cpp +++ b/modules/botserv/control.cpp @@ -75,7 +75,7 @@ class CommandBSSay : public Command ci->GetBot()->lastmsg = Anope::CurTime; bool override = !source.AccessFor(ci).HasPriv("SAY"); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to say: " << text; + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to say: {0}"), text); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override @@ -145,7 +145,7 @@ class CommandBSAct : public Command ci->GetBot()->lastmsg = Anope::CurTime; bool override = !source.AccessFor(ci).HasPriv("SAY"); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to say: " << message; + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} to say: {0}"), message); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override diff --git a/modules/botserv/kick.cpp b/modules/botserv/kick.cpp index a32656f62..745525fa3 100644 --- a/modules/botserv/kick.cpp +++ b/modules/botserv/kick.cpp @@ -637,12 +637,12 @@ class CommandBSKickBase : public Command source.Reply(_("Bot will now kick for \002{0}\002."), optname); bool override = !source.AccessFor(ci).HasPriv("SET"); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enable the " << optname << " kicker"; + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to enable the {0} kicker"), optname); } else if (param.equals_ci("OFF")) { bool override = !source.AccessFor(ci).HasPriv("SET"); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to disable the " << optname << " kicker"; + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to disable the {0} kicker"), optname); (kd->*setter)(false); (kd->*ttbsetter)(0); @@ -1099,7 +1099,7 @@ class CommandBSSetDontKickOps : public Command if (params[1].equals_ci("ON")) { bool override = !access.HasPriv("SET"); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enable dontkickops"; + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to enable dontkickops")); kd->SetDontKickOps(true); source.Reply(_("Bot \002won't kick ops\002 on channel \002{0}\002."), ci->GetName()); @@ -1107,7 +1107,7 @@ class CommandBSSetDontKickOps : public Command else if (params[1].equals_ci("OFF")) { bool override = !access.HasPriv("SET"); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to disable dontkickops"; + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to disable dontkickops")); kd->SetDontKickOps(false); source.Reply(_("Bot \002will kick ops\002 on channel \002{0}\002."), ci->GetName()); @@ -1165,7 +1165,7 @@ class CommandBSSetDontKickVoices : public Command if (params[1].equals_ci("ON")) { bool override = !access.HasPriv("SET"); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enable dontkickvoices"; + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to enable dontkickvoices")); kd->SetDontKickVoices(true); source.Reply(_("Bot \002won't kick voices\002 on channel %s."), ci->GetName().c_str()); @@ -1173,7 +1173,7 @@ class CommandBSSetDontKickVoices : public Command else if (params[1].equals_ci("OFF")) { bool override = !access.HasPriv("SET"); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to disable dontkickvoices"; + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to disable dontkickvoices")); kd->SetDontKickVoices(false); source.Reply(_("Bot \002will kick voices\002 on channel %s."), ci->GetName().c_str()); @@ -1200,15 +1200,8 @@ struct BanData struct Data { Anope::string mask; - time_t last_use; - int16_t ttb[TTB_SIZE]; - - Data() - { - last_use = 0; - for (int i = 0; i < TTB_SIZE; ++i) - this->ttb[i] = 0; - } + time_t last_use = 0; + int16_t ttb[TTB_SIZE] = { 0 }; }; private: @@ -1269,7 +1262,7 @@ class BanDataPurger : public Timer void Tick(time_t) override { - Log(LOG_DEBUG) << "bs_main: Running bandata purger"; + this->GetOwner()->logger.Debug("Running bandata purger"); for (channel_map::iterator it = ChannelList.begin(), it_end = ChannelList.end(); it != it_end; ++it) { diff --git a/modules/botserv/set.cpp b/modules/botserv/set.cpp index 6ab429d97..6845281cb 100644 --- a/modules/botserv/set.cpp +++ b/modules/botserv/set.cpp @@ -140,7 +140,7 @@ class CommandBSSetBanExpire : public Command ci->SetBanExpire(t); bool override = !access.HasPriv("SET"); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to change banexpire to " << arg; + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to change banexpire to {0}"), arg); if (!t) source.Reply(_("Bot bans will no longer automatically expire.")); diff --git a/modules/chanserv/access.cpp b/modules/chanserv/access.cpp index 967df9025..6ad67733e 100644 --- a/modules/chanserv/access.cpp +++ b/modules/chanserv/access.cpp @@ -213,7 +213,8 @@ class CommandCSAccess : public Command EventManager::Get()->Dispatch(&Event::AccessAdd::OnAccessAdd, ci, source, access); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to add " << mask << " with level " << level; + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to add {0} with level {1}"), mask, level); + if (p != NULL) source.Reply(_("\002{0}\002 added to the access list of \002{1}\002 with privilege \002{2}\002 (level \002{3}\002)."), access->Mask(), ci->GetName(), p->name, level); else @@ -283,7 +284,7 @@ class CommandCSAccess : public Command source.Reply(_("There are no entries matching \002{0}\002 on the access list of \002{1}\002."), mask, ci->GetName()); else { - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to delete " << nicks; + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to delete {0}"), mask); if (deleted == 1) source.Reply(_("Deleted \0021\002 entry from the access list of \002{0}\002."), ci->GetName()); @@ -308,7 +309,7 @@ class CommandCSAccess : public Command { source.Reply(_("\002{0}\002 deleted from the access list of \002{1}\002."), access->Mask(), ci->GetName()); bool override = !u_access.founder && !u_access.HasPriv("ACCESS_CHANGE") && !access->Mask().equals_ci(source.nc->GetDisplay()); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to delete " << access->Mask(); + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to delete {3}"), access->Mask()); EventManager::Get()->Dispatch(&Event::AccessDel::OnAccessDel, ci, source, access); delete access; @@ -458,7 +459,7 @@ class CommandCSAccess : public Command source.Reply(_("The access list of \002{0}\002 has been cleared."), ci->GetName()); bool override = !source.IsFounder(ci); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to clear the access list"; + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to clear the access list")); } public: @@ -672,7 +673,7 @@ class CommandCSLevels : public Command else { bool override = !source.AccessFor(ci).HasPriv("FOUNDER"); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to set " << p->name << " to level " << level; + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to set {0} to level {1}"), p->name, level); ci->SetLevel(p->name, level); EventManager::Get()->Dispatch(&Event::LevelChange::OnLevelChange, source, ci, p->name, level); @@ -699,7 +700,7 @@ class CommandCSLevels : public Command if (p != NULL) { bool override = !source.AccessFor(ci).HasPriv("FOUNDER"); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to disable " << p->name; + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to disable {0}"), p->name); ci->SetLevel(p->name, ChanServ::ACCESS_INVALID); EventManager::Get()->Dispatch(&Event::LevelChange::OnLevelChange, source, ci, p->name, ChanServ::ACCESS_INVALID); @@ -754,7 +755,7 @@ class CommandCSLevels : public Command void DoReset(CommandSource &source, ChanServ::Channel *ci) { bool override = !source.AccessFor(ci).HasPriv("FOUNDER"); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to reset all levels"; + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to reset all levels")); ci->ClearLevels(); EventManager::Get()->Dispatch(&Event::LevelChange::OnLevelChange, source, ci, "ALL", 0); diff --git a/modules/chanserv/akick.cpp b/modules/chanserv/akick.cpp index 9338a4dd7..35bca6818 100644 --- a/modules/chanserv/akick.cpp +++ b/modules/chanserv/akick.cpp @@ -302,7 +302,10 @@ class CommandCSAKick : public Command else ak = ci->AddAkick(source.GetNick(), mask, reason); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to add " << mask << (reason == "" ? "" : ": ") << reason; + if (reason.empty()) + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to add {0}"), mask); + else + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to add {0} ({1})"), mask, reason); EventManager::Get()->Dispatch(&Event::Akick::OnAkickAdd, source, ci, ak); @@ -337,10 +340,11 @@ class CommandCSAKick : public Command EventManager::Get()->Dispatch(&Event::Akick::OnAkickDel, source, ci, ak); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to delete " << (ak->GetAccount() ? ak->GetAccount()->GetDisplay() : ak->GetMask()); + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to delete {0}"), + ak->GetAccount() ? ak->GetAccount()->GetDisplay() : ak->GetMask()); ++deleted; - delete ak; + ak->Delete(); }, [&]() { @@ -357,29 +361,33 @@ class CommandCSAKick : public Command { NickServ::Nick *na = NickServ::FindNick(mask); NickServ::Account *nc = na ? na->GetAccount() : nullptr; + AutoKick *match = nullptr; - unsigned int i, end; - for (i = 0, end = ci->GetAkickCount(); i < end; ++i) + for (unsigned int i = 0; i < ci->GetAkickCount(); ++i) { AutoKick *ak = ci->GetAkick(i); if (ak->GetAccount() ? ak->GetAccount() == nc : mask.equals_ci(ak->GetMask())) + { + match = ak; break; + } } - if (i == ci->GetAkickCount()) + if (match == nullptr) { source.Reply(_("\002{0}\002 was not found on the auto kick list of \002{1}\002."), mask, ci->GetName()); return; } - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to delete " << mask; + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to delete {0}"), + match->GetAccount() ? match->GetAccount()->GetDisplay() : match->GetMask()); - EventManager::Get()->Dispatch(&Event::Akick::OnAkickDel, source, ci, ci->GetAkick(i)); + EventManager::Get()->Dispatch(&Event::Akick::OnAkickDel, source, ci, match); - delete ci->GetAkick(i); + source.Reply(_("\002{0}\002 deleted from the auto kick list of \002{1}\002."), match->GetAccount() ? match->GetAccount()->GetDisplay() : match->GetMask(), ci->GetName()); - source.Reply(_("\002{0}\002 deleted from the auto kick list of \002{1}\002."), mask, ci->GetName()); + match->Delete(); } } @@ -523,7 +531,8 @@ class CommandCSAKick : public Command } bool override = !source.AccessFor(ci).HasPriv("AKICK"); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "ENFORCE, affects " << count << " users"; + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, + _("{source} used {command} on {channel} to enforce the akick list, affects {0} users"), count); source.Reply(_("Autokick enforce for \002{0}\002 complete; \002{1}\002 users were affected."), ci->GetName(), count); } @@ -531,7 +540,7 @@ class CommandCSAKick : public Command void DoClear(CommandSource &source, ChanServ::Channel *ci) { bool override = !source.AccessFor(ci).HasPriv("AKICK"); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to clear the akick list"; + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to clear the akick list")); ci->ClearAkick(); source.Reply(_("The autokick list of \002{0}\002 has been cleared."), ci->GetName()); @@ -712,7 +721,8 @@ class CSAKick : public Module if (kick) { - Log(LOG_DEBUG_2) << u->nick << " matched akick " << (ak->GetAccount() ? ak->GetAccount()->GetDisplay() : ak->GetMask()); + logger.Debug2("{0} matched akick {1}", u->nick, ak->GetAccount() ? ak->GetAccount()->GetDisplay() : ak->GetMask()); + ak->SetLastUsed(Anope::CurTime); if (!ak->GetAccount() && ak->GetMask().find('#') == Anope::string::npos) mask = ak->GetMask(); diff --git a/modules/chanserv/ban.cpp b/modules/chanserv/ban.cpp index 2b73df8fb..d79afe071 100644 --- a/modules/chanserv/ban.cpp +++ b/modules/chanserv/ban.cpp @@ -152,7 +152,7 @@ class CommandCSBan : public Command Anope::string mask = ci->GetIdealBan(u2); bool override = !u_access.HasPriv("BAN") || (u != u2 && ci->IsPeace() && u2_access >= u_access); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "for " << mask; + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} for {0}"), mask); if (!c->HasMode(mode, mask)) { @@ -188,7 +188,7 @@ class CommandCSBan : public Command Anope::string mask = IRCD->NormalizeMask(target); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "for " << mask; + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} for {0}"), mask); if (!c->HasMode(mode, mask)) { diff --git a/modules/chanserv/clone.cpp b/modules/chanserv/clone.cpp index 8d0c1ce3a..343e6c5b2 100644 --- a/modules/chanserv/clone.cpp +++ b/modules/chanserv/clone.cpp @@ -209,7 +209,8 @@ public: return; } - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to clone " << (what.empty() ? "everything from it" : what) << " to " << target_ci->GetName(); + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to clone {0} to {1}"), + what.empty() ? "everything from it" : what, target_ci->GetName()); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override diff --git a/modules/chanserv/drop.cpp b/modules/chanserv/drop.cpp index 77ab7e55e..122ac96b8 100644 --- a/modules/chanserv/drop.cpp +++ b/modules/chanserv/drop.cpp @@ -63,7 +63,8 @@ class CommandCSDrop : public Command return; bool override = (ci->IsSecureFounder() ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "(founder was: " << (ci->GetFounder() ? ci->GetFounder()->GetDisplay() : "none") << ")"; + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} (founder was: {0})"), + ci->GetFounder() ? ci->GetFounder()->GetDisplay() : "none"); Reference<Channel> c = ci->c; ci->Delete(); diff --git a/modules/chanserv/enforce.cpp b/modules/chanserv/enforce.cpp index e1d084075..8d41c7af3 100644 --- a/modules/chanserv/enforce.cpp +++ b/modules/chanserv/enforce.cpp @@ -25,7 +25,7 @@ class CommandCSEnforce : public Command void DoSecureOps(CommandSource &source, ChanServ::Channel *ci) { bool override = !source.AccessFor(ci).HasPriv("AKICK") && source.HasPriv("chanserv/access/modify"); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enforce secureops"; + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to enforce secureops")); /* Dirty hack to allow Channel::SetCorrectModes to work ok. * We pretend like SECUREOPS is on so it doesn't ignore that @@ -51,7 +51,7 @@ class CommandCSEnforce : public Command void DoRestricted(CommandSource &source, ChanServ::Channel *ci) { bool override = !source.AccessFor(ci).HasPriv("AKICK") && source.HasPriv("chanserv/access/modify"); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enforce restricted"; + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to enforce restricted")); std::vector<User *> users; for (Channel::ChanUserList::iterator it = ci->c->users.begin(), it_end = ci->c->users.end(); it != it_end; ++it) @@ -82,7 +82,7 @@ class CommandCSEnforce : public Command void DoRegOnly(CommandSource &source, ChanServ::Channel *ci) { bool override = !source.AccessFor(ci).HasPriv("AKICK") && source.HasPriv("chanserv/access/modify"); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enforce registered only"; + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to enforce registered only")); std::vector<User *> users; for (Channel::ChanUserList::iterator it = ci->c->users.begin(), it_end = ci->c->users.end(); it != it_end; ++it) @@ -114,7 +114,7 @@ class CommandCSEnforce : public Command void DoSSLOnly(CommandSource &source, ChanServ::Channel *ci) { bool override = !source.AccessFor(ci).HasPriv("AKICK") && source.HasPriv("chanserv/access/modify"); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enforce SSL only"; + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to enforce SSL only")); std::vector<User *> users; for (Channel::ChanUserList::iterator it = ci->c->users.begin(), it_end = ci->c->users.end(); it != it_end; ++it) @@ -146,7 +146,7 @@ class CommandCSEnforce : public Command void DoBans(CommandSource &source, ChanServ::Channel *ci) { bool override = !source.AccessFor(ci).HasPriv("AKICK") && source.HasPriv("chanserv/access/modify"); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enforce bans"; + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to enforce bans")); std::vector<User *> users; for (Channel::ChanUserList::iterator it = ci->c->users.begin(), it_end = ci->c->users.end(); it != it_end; ++it) @@ -175,7 +175,7 @@ class CommandCSEnforce : public Command void DoLimit(CommandSource &source, ChanServ::Channel *ci) { bool override = !source.AccessFor(ci).HasPriv("AKICK") && source.HasPriv("chanserv/access/modify"); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enforce limit"; + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to enforce limit")); Anope::string l_str; if (!ci->c->GetParam("LIMIT", l_str)) diff --git a/modules/chanserv/entrymsg.cpp b/modules/chanserv/entrymsg.cpp index c739ba46a..b2edbc56f 100644 --- a/modules/chanserv/entrymsg.cpp +++ b/modules/chanserv/entrymsg.cpp @@ -151,7 +151,9 @@ class CommandEntryMessage : public Command msg->SetChannel(ci); msg->SetCreator(source.GetNick()); msg->SetMessage(message); - Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to add a message"; + + logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to add a message")); + source.Reply(_("Entry message added to \002{0}\002"), ci->GetName()); } @@ -177,7 +179,9 @@ class CommandEntryMessage : public Command if (i > 0 && i <= messages.size()) { messages[i - 1]->Delete(); - Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to remove a message"; + + logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to remove a message")); + source.Reply(_("Entry message \002{0}\002 for \002{1]\002 deleted."), i, ci->GetName()); } else @@ -192,9 +196,10 @@ class CommandEntryMessage : public Command void DoClear(CommandSource &source, ChanServ::Channel *ci) { for (EntryMsg *e : ci->GetRefs<EntryMsg *>()) - delete e; + e->Delete(); + + logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to remove all messages")); - Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to remove all messages"; source.Reply(_("Entry messages for \002{0}\002 have been cleared."), ci->GetName()); } diff --git a/modules/chanserv/flags.cpp b/modules/chanserv/flags.cpp index 4732aff5b..d87863be0 100644 --- a/modules/chanserv/flags.cpp +++ b/modules/chanserv/flags.cpp @@ -266,9 +266,12 @@ class CommandCSFlags : public Command if (current != NULL) { EventManager::Get()->Dispatch(&Event::AccessDel::OnAccessDel, ci, source, current); - delete current; - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to delete " << mask; - source.Reply(_("\002{0}\002 removed from the access list of \002{1}\002."), mask, ci->GetName()); + + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to delete {0}"), current->Mask()); + + source.Reply(_("\002{0}\002 removed from the access list of \002{1}\002."), current->Mask(), ci->GetName()); + + current->Delete(); } else { @@ -290,11 +293,12 @@ class CommandCSFlags : public Command access->SetFlags(Anope::string(current_flags.begin(), current_flags.end())); if (current != NULL) - delete current; + current->Delete(); EventManager::Get()->Dispatch(&Event::AccessAdd::OnAccessAdd, ci, source, access); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to modify " << mask << "'s flags to " << access->AccessSerialize(); + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to modify flags of {0} to {1}"), access->Mask(), access->AccessSerialize()); + if (p != NULL) { if (add) @@ -303,7 +307,9 @@ class CommandCSFlags : public Command source.Reply(_("Privilege \002{0}\002 removed from \002{1}\002 on \002{2}\002, new flags are +\002{3}\002"), p->name, access->Mask(), ci->GetName(), access->AccessSerialize()); } else + { source.Reply(_("Flags for \002{0}\002 on \002{1}\002 set to +\002{2}\002"), access->Mask(), ci->GetName(), access->AccessSerialize()); + } } void DoList(CommandSource &source, ChanServ::Channel *ci, const std::vector<Anope::string> ¶ms) @@ -383,7 +389,7 @@ class CommandCSFlags : public Command source.Reply(_("The access list of \002{0}\002 has been cleared."), ci->GetName()); bool override = !source.IsFounder(ci); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to clear the access list"; + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to clear the access list")); } public: diff --git a/modules/chanserv/getkey.cpp b/modules/chanserv/getkey.cpp index cbcc66720..2e6835672 100644 --- a/modules/chanserv/getkey.cpp +++ b/modules/chanserv/getkey.cpp @@ -53,7 +53,7 @@ class CommandCSGetKey : public Command } bool override = !source.AccessFor(ci).HasPriv("GETKEY"); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci); + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel}")); source.Reply(_("Key for channel \002{0}\002 is \002{1}\002."), ci->GetName(), key); } diff --git a/modules/chanserv/invite.cpp b/modules/chanserv/invite.cpp index 9c21bc704..ae6cee04d 100644 --- a/modules/chanserv/invite.cpp +++ b/modules/chanserv/invite.cpp @@ -83,12 +83,12 @@ class CommandCSInvite : public Command { source.Reply(_("\002{0}\002 has been invited to \002{1}\002."), u2->nick, c->name); u2->SendMessage(ci->WhoSends(), _("You have been invited to \002{0}\002 by \002{1}\002."), c->name, source.GetNick()); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "for " << u2->nick; + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to invite {0}"), u2->nick); } else { u2->SendMessage(ci->WhoSends(), _("You have been invited to \002{0}\002."), c->name); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci); + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel}")); } } diff --git a/modules/chanserv/kick.cpp b/modules/chanserv/kick.cpp index 505f74893..fad7b9158 100644 --- a/modules/chanserv/kick.cpp +++ b/modules/chanserv/kick.cpp @@ -79,7 +79,7 @@ class CommandCSKick : public Command else { bool override = !u_access.HasPriv("KICK") || (u != u2 && ci->IsPeace() && u2_access >= u_access); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "for " << u2->nick; + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} for {0}"), u2->nick); if (ci->IsSignKick() || (ci->IsSignKickLevel() && !u_access.HasPriv("SIGNKICK"))) { @@ -96,7 +96,7 @@ class CommandCSKick : public Command { Anope::string mask = IRCD->NormalizeMask(target); - Log(LOG_COMMAND, source, this, ci) << "for " << mask; + logger.Command(LogType::COMMAND, source, ci, _("{source} used {command} on {channel} for {0}"), mask); int matched = 0, kicked = 0; for (Channel::ChanUserList::iterator it = c->users.begin(), it_end = c->users.end(); it != it_end;) diff --git a/modules/chanserv/list.cpp b/modules/chanserv/list.cpp index a60ae786c..cd855a0b3 100644 --- a/modules/chanserv/list.cpp +++ b/modules/chanserv/list.cpp @@ -215,13 +215,15 @@ class CommandCSSetPrivate : public Command if (params[1].equals_ci("ON")) { - Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable private"; + logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to enable private")); + ci->SetPrivate(true); source.Reply(_("Private option for \002{0}\002 is now \002on\002."), ci->GetName()); } else if (params[1].equals_ci("OFF")) { - Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable private"; + logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to disable private")); + ci->SetPrivate(false); source.Reply(_("Private option for \002{0}\002 is now \002off\002."), ci->GetName()); } diff --git a/modules/chanserv/log.cpp b/modules/chanserv/log.cpp index 4cbc66c7e..52724a57b 100644 --- a/modules/chanserv/log.cpp +++ b/modules/chanserv/log.cpp @@ -285,15 +285,24 @@ public: { if (log->GetExtra() == extra) { - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to remove logging for " << command << " with method " << method << (extra == "" ? "" : " ") << extra; - source.Reply(_("Logging for command \002{0}\002 on \002{1}\002 with log method \002{2}{3}{4}\002 has been removed."), !log->GetCommandName().empty() ? log->GetCommandName() : log->GetServiceName(), !log->GetCommandService().empty() ? log->GetCommandService() : "any service", method, extra.empty() ? "" : " ", extra); - delete log; + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to remove logging for {0} with method {1}"), + command, method + (extra.empty() ? "" : (" " + extra))); + + source.Reply(_("Logging for command \002{0}\002 on \002{1}\002 with log method \002{2}{3}{4}\002 has been removed."), + !log->GetCommandName().empty() ? log->GetCommandName() : log->GetServiceName(), + !log->GetCommandService().empty() ? log->GetCommandService() : "any service", method, extra.empty() ? "" : " ", extra); + log->Delete(); } else { log->SetExtra(extra); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to change logging for " << command << " to method " << method << (extra == "" ? "" : " ") << extra; - source.Reply(_("Logging changed for command \002{0}\002 on \002{1}\002, now using log method \002{2}{3}{4]\002."), !log->GetCommandName().empty() ? log->GetCommandName() : log->GetServiceName(), !log->GetCommandService().empty() ? log->GetCommandService() : "any service", method, extra.empty() ? "" : " ", extra); + + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to change logging for {0} to method {1}"), + command, method + (extra.empty() ? "" : (" " + extra))); + + source.Reply(_("Logging changed for command \002{0}\002 on \002{1}\002, now using log method \002{2}{3}{4]\002."), + !log->GetCommandName().empty() ? log->GetCommandName() : log->GetServiceName(), + !log->GetCommandService().empty() ? log->GetCommandService() : "any service", method, extra.empty() ? "" : " ", extra); } return; } @@ -310,9 +319,11 @@ public: log->SetCreated(Anope::CurTime); log->SetCreator(source.GetNick()); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to log " << command << " with method " << method << (extra == "" ? "" : " ") << extra; + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, + _("{source} used {command} on {channel} to log {0} to method {1}"), command, method + (extra.empty() ? "" : (" " + extra))); - source.Reply(_("Logging is now active for command \002{0}\002 on \002{1}\002, using log method \002{2}{3}{4}\002."), !command_name.empty() ? command_name : service_name, bi ? bi->nick : "any service", method, extra.empty() ? "" : " ", extra); + source.Reply(_("Logging is now active for command \002{0}\002 on \002{1}\002, using log method \002{2}{3}{4}\002."), + !command_name.empty() ? command_name : service_name, bi ? bi->nick : "any service", method, extra.empty() ? "" : " ", extra); } else { @@ -423,9 +434,11 @@ class CSLog : public Module } } - void OnLog(::Log *l) override + void OnLog(Logger *l) override { - if (l->type != LOG_COMMAND || l->u == NULL || l->c == NULL || l->ci == NULL || !Me || !Me->IsSynced()) +#warning "fix log" +#if 0 + if (l->type != LogType::COMMAND || l->u == NULL || l->c == NULL || l->ci == NULL || !Me || !Me->IsSynced()) return; std::vector<LogSetting *> ls = l->ci->GetRefs<LogSetting *>(); @@ -463,6 +476,7 @@ class CSLog : public Module else if (log->GetMethod().equals_ci("NOTICE") && l->ci->c) IRCD->SendNotice(l->ci->WhoSends(), log->GetExtra() + l->ci->c->name, buffer); } +#endif } }; diff --git a/modules/chanserv/main/channel.cpp b/modules/chanserv/main/channel.cpp index a35c80901..d10abbc0d 100644 --- a/modules/chanserv/main/channel.cpp +++ b/modules/chanserv/main/channel.cpp @@ -30,7 +30,7 @@ void ChannelImpl::Delete() { EventManager::Get()->Dispatch(&Event::DelChan::OnDelChan, this); - Log(LOG_DEBUG) << "Deleting channel " << this->GetName(); + Anope::Logger.Debug("Deleting channel {0}", this->GetName()); if (this->c) { @@ -361,7 +361,7 @@ ChanServ::AccessGroup ChannelImpl::AccessFor(const User *u, bool updateLastUsed) return group; NickServ::Account *nc = u->Account(); - if (nc == NULL && !nc->IsSecure() && u->IsRecognized()) + if (nc == NULL && !this->IsSecure() && u->IsRecognized()) { NickServ::Nick *na = NickServ::FindNick(u->nick); if (na != NULL) @@ -480,7 +480,7 @@ int16_t ChannelImpl::GetLevel(const Anope::string &priv) ChanServ::Privilege *p = ChanServ::service ? ChanServ::service->FindPrivilege(priv) : nullptr; if (!p) { - Log(LOG_DEBUG) << "Unknown privilege " + priv; + Anope::Logger.Debug("Unknown privilege {0}", priv); return ChanServ::ACCESS_INVALID; } @@ -499,7 +499,7 @@ void ChannelImpl::SetLevel(const Anope::string &priv, int16_t level) ChanServ::Privilege *p = ChanServ::service ? ChanServ::service->FindPrivilege(priv) : nullptr; if (!p) { - Log(LOG_DEBUG) << "Unknown privilege " + priv; + Anope::Logger.Debug("Unknown privilege {0}", priv); return; } @@ -538,7 +538,7 @@ Anope::string ChannelImpl::GetIdealBan(User *u) else return "*!" + u->GetVIdent() + "@" + u->GetDisplayedHost(); case 3: - return "*!" + u->Mask(); + return "*!" + u->WildMask(); case 2: default: return "*!*@" + u->GetDisplayedHost(); diff --git a/modules/chanserv/main/chanserv.cpp b/modules/chanserv/main/chanserv.cpp index 492f64459..62d1e81ba 100644 --- a/modules/chanserv/main/chanserv.cpp +++ b/modules/chanserv/main/chanserv.cpp @@ -309,7 +309,9 @@ class ChanServCore : public Module if (newowner) { - ::Log(LOG_NORMAL, "chanserv/drop", ChanServ) << "Transferring foundership of " << ci->GetName() << " from deleted account " << nc->GetDisplay() << " to " << newowner->GetDisplay(); + ChanServ->logger.Category("chanserv/drop").Log(_("Transferring foundership of {0} from deleted account {1} to {2}"), + ci->GetName(), nc->GetDisplay(), newowner->GetDisplay()); + ci->SetFounder(newowner); // Can't be both founder and successor @@ -318,7 +320,8 @@ class ChanServCore : public Module } else { - ::Log(LOG_NORMAL, "chanserv/drop", ChanServ) << "Deleting channel " << ci->GetName() << " owned by deleted account " << nc->GetDisplay(); + ChanServ->logger.Category("chanserv/drop").Log(_("Deleting channel {0} owned by deleted account {1}"), + ci->GetName(), nc->GetDisplay()); ci->Delete(); continue; @@ -408,10 +411,13 @@ class ChanServCore : public Module } } - void OnLog(::Log *l) override + void OnLog(Logger *l) override { - if (l->type == LOG_CHANNEL) +#warning "" +#if 0 + if (l->type == LogType::CHANNEL) l->bi = ChanServ; +#endif } void OnExpireTick() override @@ -442,7 +448,9 @@ class ChanServCore : public Module if (expire) { - ::Log(LOG_NORMAL, "chanserv/expire", ChanServ) << "Expiring channel " << ci->GetName() << " (founder: " << (ci->GetFounder() ? ci->GetFounder()->GetDisplay() : "(none)") << ")"; + ChanServ->logger.Category("chanserv/expire").Log(_("Expiring channel {0} (founder: {1})"), + ci->GetName(), ci->GetFounder() ? ci->GetFounder()->GetDisplay() : "(none)"); + EventManager::Get()->Dispatch(&ChanServ::Event::ChanExpire::OnChanExpire, ci); ci->Delete(); } @@ -511,7 +519,7 @@ class ChanServCore : public Module { if (always_lower && c->ci && c->creation_time > c->ci->GetTimeRegistered()) { - ::Log(LOG_DEBUG) << "Changing TS of " << c->name << " from " << c->creation_time << " to " << c->ci->GetTimeRegistered(); + logger.Debug("Changing TS of {0} from {1} to {2}", c->name, c->creation_time, c->ci->GetTimeRegistered()); c->creation_time = c->ci->GetTimeRegistered(); IRCD->Send<messages::MessageChannel>(c); c->Reset(); diff --git a/modules/chanserv/mode.cpp b/modules/chanserv/mode.cpp index 5a22b4be8..e76469823 100644 --- a/modules/chanserv/mode.cpp +++ b/modules/chanserv/mode.cpp @@ -374,7 +374,8 @@ class CommandCSMode : public Command if (!reply.empty()) { source.Reply(_("\002{0}\002 locked on \002{1}\002."), reply, ci->GetName()); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to lock " << reply; + + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to lock {0}"), reply); } else if (needreply) { @@ -430,7 +431,9 @@ class CommandCSMode : public Command if (!mode_param.empty()) mode_param = " " + mode_param; source.Reply(_("\002{0}{1}{2}\002 has been unlocked from \002{3}\002."), adding == 1 ? '+' : '-', cm->mchar, mode_param, ci->GetName()); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to unlock " << (adding ? '+' : '-') << cm->mchar << mode_param; + + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to unlock {0}"), + (adding ? '+' : '-') + cm->mchar + mode_param); } else { @@ -493,7 +496,8 @@ class CommandCSMode : public Command Anope::string modes = params[2], param; bool override = !source.AccessFor(ci).HasPriv("MODE") && source.HasPriv("chanserv/administration"); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to set " << params[2] << (params.size() > 3 ? " " + params[3] : ""); + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to set {3}"), + params[2] + (params.size() > 3 ? " " + params[3] : "")); int adding = -1; for (size_t i = 0; i < modes.length(); ++i) @@ -850,7 +854,7 @@ class CommandCSModes : public Command else ci->c->RemoveMode(NULL, m.second, targ->GetUID()); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "on " << targ->nick; + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} on {3}"), targ->nick); } const Anope::string GetDesc(CommandSource &source) const override diff --git a/modules/chanserv/register.cpp b/modules/chanserv/register.cpp index 1e2a6a2bd..0e7bff7a0 100644 --- a/modules/chanserv/register.cpp +++ b/modules/chanserv/register.cpp @@ -121,7 +121,8 @@ class CommandCSRegister : public Command ci->SetLastTopicSetter(source.service->nick); } - Log(LOG_COMMAND, source, this, ci); + logger.Command(LogType::COMMAND, source, ci, _("{source} used {command} on {channel}")); + source.Reply(_("Channel \002{0}\002 registered under your account: \002{1}\002"), chan, nc->GetDisplay()); /* Implement new mode lock */ diff --git a/modules/chanserv/seen.cpp b/modules/chanserv/seen.cpp index 113691343..2028634f4 100644 --- a/modules/chanserv/seen.cpp +++ b/modules/chanserv/seen.cpp @@ -165,12 +165,12 @@ class CommandOSSeen : public Command ++it; if (time < buf->second->last) { - Log(LOG_DEBUG) << buf->first << " was last seen " << Anope::strftime(buf->second->last) << ", deleting entry"; + Log(LogType::DEBUG) << buf->first << " was last seen " << Anope::strftime(buf->second->last) << ", deleting entry"; delete buf->second; counter++; } } - Log(LOG_ADMIN, source, this) << "CLEAR and removed " << counter << " nicks that were added after " << Anope::strftime(time, NULL, true); + Log(LogType::ADMIN, source, this) << "CLEAR and removed " << counter << " nicks that were added after " << Anope::strftime(time, NULL, true); source.Reply(_("Database cleared, removed %lu nicks that were added after %s."), counter, Anope::strftime(time, source.nc, true).c_str()); } else @@ -423,11 +423,11 @@ class CSSeen : public Module if ((Anope::CurTime - cur->second->last) > purgetime) { - Log(LOG_DEBUG) << cur->first << " was last seen " << Anope::strftime(cur->second->last) << ", purging entries"; + Log(LogType::DEBUG) << cur->first << " was last seen " << Anope::strftime(cur->second->last) << ", purging entries"; delete cur->second; } } - Log(LOG_DEBUG) << "cs_seen: Purged database, checked " << previous_size << " nicks and removed " << (previous_size - database.size()) << " old entries."; + Log(LogType::DEBUG) << "cs_seen: Purged database, checked " << previous_size << " nicks and removed " << (previous_size - database.size()) << " old entries."; } void OnUserConnect(User *u, bool &exempt) override diff --git a/modules/chanserv/set.cpp b/modules/chanserv/set.cpp index 833817cde..7b6775c2f 100644 --- a/modules/chanserv/set.cpp +++ b/modules/chanserv/set.cpp @@ -26,7 +26,7 @@ class CommandCSSet : public Command { ServiceReference<ModeLocks> mlocks; - + public: CommandCSSet(Module *creator) : Command(creator, "chanserv/set", 2, 3) { @@ -117,13 +117,15 @@ class CommandCSSetAutoOp : public Command if (params[1].equals_ci("ON")) { - Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable autoop"; + logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to enable autoop")); + ci->SetNoAutoop(false); source.Reply(_("Services will now automatically give modes to users in \002{0}\002."), ci->GetName()); } else if (params[1].equals_ci("OFF")) { - Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable autoop"; + logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to disable autoop")); + ci->SetNoAutoop(true); source.Reply(_("Services will no longer automatically give modes to users in \002{0}\002."), ci->GetName()); } @@ -182,7 +184,9 @@ class CommandCSSetBanType : public Command int16_t new_type = convertTo<int16_t>(params[1]); if (new_type < 0 || new_type > 3) throw ConvertException("Invalid range"); - Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to change the ban type to " << new_type; + + logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to change the ban type to {0}"), new_type); + ci->SetBanType(new_type); source.Reply(_("Ban type for channel \002{0}\002 is now \002#{1}\002."), ci->GetName(), new_type); } @@ -247,12 +251,14 @@ class CommandCSSetDescription : public Command ci->SetDesc(param); if (!param.empty()) { - Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to change the description to " << ci->GetDesc(); + logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to change the description to {0}"), ci->GetDesc()); + source.Reply(_("Description of \002{0}\002 changed to \002{1}\002."), ci->GetName(), ci->GetDesc()); } else { - Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to unset the description"; + logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to unset the description")); + source.Reply(_("Description of \002{0}\002 unset."), ci->GetName()); } } @@ -317,7 +323,8 @@ class CommandCSSetFounder : public Command return; } - Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to change the founder from " << (ci->GetFounder() ? ci->GetFounder()->GetDisplay() : "(none)") << " to " << nc->GetDisplay(); + logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to change the founder from {0} to {1}"), + ci->GetFounder() ? ci->GetFounder()->GetDisplay() : "(none)", nc->GetDisplay()); ci->SetFounder(nc); @@ -373,7 +380,8 @@ class CommandCSSetKeepModes : public Command if (param.equals_ci("ON")) { - Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable keep modes"; + logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to enable keep modes")); + ci->SetKeepModes(true); source.Reply(_("Keep modes for \002{0}\002 is now \002on\002."), ci->GetName()); if (ci->c) @@ -387,7 +395,8 @@ class CommandCSSetKeepModes : public Command } else if (param.equals_ci("OFF")) { - Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable keep modes"; + logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to disable keep modes")); + ci->SetKeepModes(false); source.Reply(_("Keep modes for \002{0}\002 is now \002off\002."), ci->GetName()); for (ChanServ::Mode *m : ci->GetRefs<ChanServ::Mode *>()) @@ -446,13 +455,15 @@ class CommandCSSetPeace : public Command if (param.equals_ci("ON")) { - Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable peace"; + logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to enable peace")); + ci->SetPeace(true); source.Reply(_("Peace option for \002{0}\002 is now \002on\002."), ci->GetName()); } else if (param.equals_ci("OFF")) { - Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable peace"; + logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to disable peace")); + ci->SetPeace(false); source.Reply(_("Peace option for \002{0}\002 is now \002off\002."), ci->GetName()); } @@ -481,7 +492,7 @@ inline static Anope::string BotModes() class CommandCSSetPersist : public Command { ServiceReference<ModeLocks> mlocks; - + public: CommandCSSetPersist(Module *creator, const Anope::string &cname = "chanserv/set/persist") : Command(creator, cname, 2, 2) { @@ -570,7 +581,8 @@ class CommandCSSetPersist : public Command } } - Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable persist"; + logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to enable persist")); + source.Reply(_("Channel \002{0}\002 is now persistent."), ci->GetName()); } else if (params[1].equals_ci("OFF")) @@ -607,7 +619,8 @@ class CommandCSSetPersist : public Command } } - Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable persist"; + logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to disable persist")); + source.Reply(_("Channel \002{0}\002 is no longer persistent."), ci->GetName()); } else @@ -664,13 +677,15 @@ class CommandCSSetRestricted : public Command if (param.equals_ci("ON")) { - Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable restricted"; + logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to enable restricted")); + ci->SetRestricted(true); source.Reply(_("Restricted access option for \002{0}\002 is now \002on\002."), ci->GetName()); } else if (param.equals_ci("OFF")) { - Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable restricted"; + logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to disabled restricted")); + ci->SetRestricted(false); source.Reply(_("Restricted access option for \002{0}\002 is now \002off\002."), ci->GetName()); } @@ -727,13 +742,15 @@ class CommandCSSetSecure : public Command if (param.equals_ci("ON")) { - Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable secure"; + logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to enable secure")); + ci->SetSecure(true); source.Reply(_("Secure option for \002{0}\002 is now \002on\002."), ci->GetName()); } else if (param.equals_ci("OFF")) { - Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable secure"; + logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to disable secure")); + ci->SetSecure(false); source.Reply(_("Secure option for \002{0}\002 is now \002off\002."), ci->GetName()); } @@ -792,13 +809,15 @@ class CommandCSSetSecureFounder : public Command if (param.equals_ci("ON")) { - Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable secure founder"; + logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to enable secure founder")); + ci->SetSecureFounder(true); source.Reply(_("Secure founder option for \002{0}\002 is now \002on\002."), ci->GetName()); } else if (param.equals_ci("OFF")) { - Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable secure founder"; + logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to disable secure founder")); + ci->SetSecureFounder(false); source.Reply(_("Secure founder option for \002{0}\002 is now \002off\002."), ci->GetName()); } @@ -860,13 +879,15 @@ class CommandCSSetSecureOps : public Command if (param.equals_ci("ON")) { - Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable secure ops"; + logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to enable secure ops")); + ci->SetSecureOps(true); source.Reply(_("Secure ops option for \002{0}\002 is now \002on\002."), ci->GetName()); } else if (param.equals_ci("OFF")) { - Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable secure ops"; + logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to disable secure ops")); + ci->SetSecureOps(false); source.Reply(_("Secure ops option for \002{0}\002 is now \002off\002."), ci->GetName()); } @@ -927,21 +948,24 @@ class CommandCSSetSignKick : public Command ci->SetSignKick(true); ci->SetSignKickLevel(false); source.Reply(_("Signed kick option for \002{0}\002 is now \002on\002."), ci->GetName()); - Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable sign kick"; + + logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to enable sign kick")); } else if (param.equals_ci("LEVEL")) { ci->SetSignKick(false); ci->SetSignKickLevel(true); source.Reply(_("Signed kick option for \002{0}\002 is now \002on\002, but depends of the privileges of the user that is using the command."), ci->GetName()); - Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable sign kick level"; + + logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to enable sign kick level")); } else if (param.equals_ci("OFF")) { ci->SetSignKick(false); ci->SetSignKickLevel(false); source.Reply(_("Signed kick option for \002{0}\002 is now \002off\002."), ci->GetName()); - Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable sign kick"; + + logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to disable sign kick")); } else { @@ -1018,7 +1042,8 @@ class CommandCSSetSuccessor : public Command nc = na->GetAccount(); } - Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to change the successor from " << (ci->GetSuccessor() ? ci->GetSuccessor()->GetDisplay() : "(none)") << " to " << (nc ? nc->GetDisplay() : "(none)"); + logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to change the successor from {0} to {1}"), + ci->GetSuccessor() ? ci->GetSuccessor()->GetDisplay() : "(none)", nc ? nc->GetDisplay() : "(none)"); ci->SetSuccessor(nc); @@ -1072,13 +1097,15 @@ class CommandCSSetNoexpire : public Command if (param.equals_ci("ON")) { - Log(LOG_ADMIN, source, this, ci) << "to enable noexpire"; + logger.Command(LogType::ADMIN, source, ci, _("{source} used {command} on {channel} to enable noexpire")); + ci->SetNoExpire(true); source.Reply(_("Channel \002{0} will not\002 expire."), ci->GetName()); } else if (param.equals_ci("OFF")) { - Log(LOG_ADMIN, source, this, ci) << "to disable noexpire"; + logger.Command(LogType::ADMIN, source, ci, _("{source} used {command} on {channel} to disable noexpire")); + ci->SetNoExpire(false); source.Reply(_("Channel \002{0} will\002 expire."), ci->GetName()); } @@ -1240,7 +1267,7 @@ class CSSet : public Module { if (persist_lower_ts && c->ci && c->ci->IsPersist() && c->creation_time > c->ci->GetTimeRegistered()) { - Log(LOG_DEBUG) << "Changing TS of " << c->name << " from " << c->creation_time << " to " << c->ci->GetTimeRegistered(); + logger.Debug("Changing TS of {0} from {1} to {2}", c->name, c->creation_time, c->ci->GetTimeRegistered()); c->creation_time = c->ci->GetTimeRegistered(); IRCD->Send<messages::MessageChannel>(c); c->Reset(); diff --git a/modules/chanserv/set_misc.cpp b/modules/chanserv/set_misc.cpp index 7bf55dfc6..76f4c7017 100644 --- a/modules/chanserv/set_misc.cpp +++ b/modules/chanserv/set_misc.cpp @@ -151,12 +151,16 @@ class CommandCSSetMisc : public Command data->SetName(scommand); data->SetData(param); - Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to change it to " << param; + logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, + _("{source} used {command} on {channel} to change it to {0}"), + param); + source.Reply(_("\002{0}\002 for \002{1}\002 set to \002{2}\002."), scommand, ci->GetName(), param); } else { - Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to unset it"; + logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to unset it")); + source.Reply(_("\002{0}\002 for \002{1}\002 unset."), scommand, ci->GetName()); } } diff --git a/modules/chanserv/suspend.cpp b/modules/chanserv/suspend.cpp index 7895aaa02..c686ffdb7 100644 --- a/modules/chanserv/suspend.cpp +++ b/modules/chanserv/suspend.cpp @@ -189,7 +189,9 @@ class CommandCSSuspend : public Command ci->c->Kick(NULL, users[i], !reason.empty() ? reason : Language::Translate(users[i], _("This channel has been suspended."))); } - Log(LOG_ADMIN, source, this, ci) << "(" << (!reason.empty() ? reason : "No reason") << "), expires on " << (expiry_secs ? Anope::strftime(Anope::CurTime + expiry_secs) : "never"); + logger.Command(LogType::ADMIN, source, ci, _("{source} used {command} on {channel} ({0}), expires on {1}"), + !reason.empty() ? reason : "No reason", expiry_secs ? Anope::strftime(Anope::CurTime + expiry_secs) : "never"); + source.Reply(_("Channel \002{0}\002 is now suspended."), ci->GetName()); EventManager::Get()->Dispatch(&Event::ChanSuspend::OnChanSuspend, ci); @@ -234,11 +236,12 @@ class CommandCSUnSuspend : public Command return; } - Log(LOG_ADMIN, source, this, ci) << "which was suspended by " << si->GetBy() << " for: " << (!si->GetReason().empty() ? si->GetReason() : "No reason"); + logger.Command(LogType::ADMIN, source, ci, _("{source} used {command} on {channel} which was suspended by {0} for: {1}"), + si->GetBy(), !si->GetReason().empty() ? si->GetReason() : "No reason"); si->Delete(); - source.Reply(_("Channel \002%s\002 is now released."), ci->GetName().c_str()); + source.Reply(_("Channel \002{0}\002 is now released."), ci->GetName()); EventManager::Get()->Dispatch(&Event::ChanUnsuspend::OnChanUnsuspend, ci); } @@ -320,7 +323,7 @@ class CSSuspend : public Module ci->SetLastUsed(Anope::CurTime); si->Delete(); - Log(this) << "Expiring suspend for " << ci->GetName(); + logger.Channel(ci).Log(_("Expiring suspend for {0}"), ci->GetName()); } } diff --git a/modules/chanserv/sync.cpp b/modules/chanserv/sync.cpp index 9f9ba4ff7..c532d4fad 100644 --- a/modules/chanserv/sync.cpp +++ b/modules/chanserv/sync.cpp @@ -52,7 +52,7 @@ class CommandCSSync : public Command } bool override = !source.AccessFor(ci).HasPriv("ACCESS_CHANGE") && source.HasPriv("chanserv/administration"); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci); + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel}")); for (Channel::ChanUserList::iterator it = ci->c->users.begin(), it_end = ci->c->users.end(); it != it_end; ++it) ci->c->SetCorrectModes(it->second->user, true); diff --git a/modules/chanserv/topic.cpp b/modules/chanserv/topic.cpp index db4d25dbd..648c322fb 100644 --- a/modules/chanserv/topic.cpp +++ b/modules/chanserv/topic.cpp @@ -62,13 +62,15 @@ class CommandCSSetKeepTopic : public Command if (param.equals_ci("ON")) { - Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable keeptopic"; + logger.Command(!source.AccessFor(ci).HasPriv("SET") ? LogType::OVERRIDE : LogType::COMMAND, source, _("{source} used {command} on {channel} to enable keeptopic")); + ci->SetKeepTopic(true); source.Reply(_("Topic retention option for \002{0}\002 is now \002on\002."), ci->GetName()); } else if (param.equals_ci("OFF")) { - Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable keeptopic"; + logger.Command(!source.AccessFor(ci).HasPriv("SET") ? LogType::OVERRIDE : LogType::COMMAND, source, _("{source} used {command} on {channel} to disable keeptopic")); + ci->SetKeepTopic(false); source.Reply(_("Topic retention option for \002{0}\002 is now \002off\002."), ci->GetName()); } @@ -132,7 +134,10 @@ class CommandCSTopic : public Command ci->SetTopicLock(true); bool override = !source.AccessFor(ci).HasPriv("TOPIC"); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << (!topic.empty() ? "to change the topic to: " : "to unset the topic") << (!topic.empty() ? topic : ""); + if (!topic.empty()) + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, _("{source} used {command} on {channel} to change the topic to: {0}"), topic); + else + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, _("{source} used {command} on {channel} to unset the topic")); } void Append(CommandSource &source, ChanServ::Channel *ci, const std::vector<Anope::string> ¶ms) diff --git a/modules/chanserv/unban.cpp b/modules/chanserv/unban.cpp index 035819ff2..ac7c08fdf 100644 --- a/modules/chanserv/unban.cpp +++ b/modules/chanserv/unban.cpp @@ -42,20 +42,20 @@ class CommandCSUnban : public Command if (!source.GetUser()) return; - unsigned count = 0; + unsigned int count = 0; for (ChanServ::Channel *ci : source.GetAccount()->GetRefs<ChanServ::Channel *>()) { if (!ci->c || !source.AccessFor(ci).HasPriv("UNBAN")) continue; - for (unsigned j = 0; j < modes.size(); ++j) + for (unsigned int j = 0; j < modes.size(); ++j) if (ci->c->Unban(source.GetUser(), modes[j]->name, true)) ++count; } - Log(LOG_COMMAND, source, this, NULL) << "on all channels"; - source.Reply(_("You have been unbanned from %d channels."), count); + logger.Command(LogType::COMMAND, source, _("{source} used {command} on all channels")); + source.Reply(_("You have been unbanned from \002{0}\002 channels."), count); return; } @@ -92,7 +92,7 @@ class CommandCSUnban : public Command } bool override = !source.AccessFor(ci).HasPriv("UNBAN") && source.HasPriv("chanserv/kick"); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to unban " << u2->nick; + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, _("{source} used {command} on {channel} to unban {0}"), u2->nick); for (unsigned i = 0; i < modes.size(); ++i) ci->c->Unban(u2, modes[i]->name, source.GetUser() == u2); diff --git a/modules/chanserv/updown.cpp b/modules/chanserv/updown.cpp index 38ed65776..d3ceb617a 100644 --- a/modules/chanserv/updown.cpp +++ b/modules/chanserv/updown.cpp @@ -68,7 +68,8 @@ class CommandCSUp : public Command Channel *c = it->second->chan; SetModes(source.GetUser(), c); } - Log(LOG_COMMAND, source, this, NULL) << "on all channels to update their status modes"; + + logger.Command(LogType::COMMAND, source, _("{source} used {command} on all channels to update their status modes"), source.GetSource(), source.GetCommand()); return; } @@ -131,7 +132,8 @@ class CommandCSUp : public Command } } - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, c->ci) << "to update the status modes of " << u->nick; + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to update the status modes of {0}"), u->nick); + SetModes(u, c); } @@ -172,7 +174,7 @@ class CommandCSDown : public Command Channel *c = it->second->chan; RemoveAll(source.GetUser(), c); } - Log(LOG_COMMAND, source, this, NULL) << "on all channels to remove their status modes"; + logger.Command(LogType::COMMAND, source, _("{source} used {command} on all channels to remove their status modes"), source.GetSource(), source.GetCommand()); return; } @@ -236,7 +238,8 @@ class CommandCSDown : public Command } } - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, c->ci) << "to remove the status modes from " << u->nick; + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to remove the status modes from {0}"), u->nick); + RemoveAll(u, c); } diff --git a/modules/chanserv/xop.cpp b/modules/chanserv/xop.cpp index de5ca0c0b..b95580a2b 100644 --- a/modules/chanserv/xop.cpp +++ b/modules/chanserv/xop.cpp @@ -134,7 +134,7 @@ class CommandCSXOP : public Command if (Anope::ReadOnly) { - source.Reply(_("Sorry, channel %s list modification is temporarily disabled."), source.command.c_str()); + source.Reply(_("Sorry, channel {0} list modification is temporarily disabled."), source.command); return; } @@ -244,10 +244,10 @@ class CommandCSXOP : public Command acc->SetLastSeen(0); acc->SetCreated(Anope::CurTime); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to add " << mask; + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to add {0}"), mask); EventManager::Get()->Dispatch(&Event::AccessAdd::OnAccessAdd, ci, source, acc); - source.Reply(_("\002%s\002 added to %s %s list."), acc->Mask(), ci->GetName().c_str(), source.command.c_str()); + source.Reply(_("\002{0}\002 added to {1} {2} list."), acc->Mask(), ci->GetName(), source.command); } void DoDel(CommandSource &source, ChanServ::Channel *ci, const std::vector<Anope::string> ¶ms) @@ -263,13 +263,13 @@ class CommandCSXOP : public Command if (Anope::ReadOnly) { - source.Reply(_("Sorry, channel %s list modification is temporarily disabled."), source.command.c_str()); + source.Reply(_("Sorry, channel {0} list modification is temporarily disabled."), source.command); return; } if (!ci->GetAccessCount()) { - source.Reply(_("%s %s list is empty."), ci->GetName().c_str(), source.command.c_str()); + source.Reply(_("{0} {1} list is empty."), ci->GetName(), source.command); return; } @@ -327,20 +327,20 @@ class CommandCSXOP : public Command nicks = caccess->Mask(); EventManager::Get()->Dispatch(&Event::AccessDel::OnAccessDel, ci, source, caccess); - delete caccess; + caccess->Delete(); }, [&]() { if (!deleted) - source.Reply(_("No matching entries on %s %s list."), ci->GetName().c_str(), source.command.c_str()); + source.Reply(_("No matching entries on {0} {1} list."), ci->GetName(), source.command); else { - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to delete " << nicks; + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to delete {0}"), nicks); if (deleted == 1) - source.Reply(_("Deleted one entry from %s %s list."), ci->GetName().c_str(), source.command.c_str()); + source.Reply(_("Deleted one entry from {0} {1} list."), ci->GetName(), source.command); else - source.Reply(_("Deleted %d entries from %s %s list."), deleted, ci->GetName().c_str(), source.command.c_str()); + source.Reply(_("Deleted {0} entries from {1} {2} list."), deleted, ci->GetName(), source.command); } }); } @@ -355,18 +355,18 @@ class CommandCSXOP : public Command if (a->Mask().equals_ci(mask)) { - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to delete " << a->Mask(); + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to delete {0}"), a->GetMask()); - source.Reply(_("\002%s\002 deleted from %s %s list."), a->Mask().c_str(), ci->GetName().c_str(), source.command.c_str()); + source.Reply(_("\002{0}\002 deleted from {1} {2} list."), a->Mask(), ci->GetName(), source.command); EventManager::Get()->Dispatch(&Event::AccessDel::OnAccessDel, ci, source, a); - delete a; + a->Delete(); return; } } - source.Reply(_("\002%s\002 not found on %s %s list."), mask.c_str(), ci->GetName().c_str(), source.command.c_str()); + source.Reply(_("\002{0}\002 not found on {1} {2} list."), mask, ci->GetName(), source.command); } } @@ -385,7 +385,7 @@ class CommandCSXOP : public Command if (!ci->GetAccessCount()) { - source.Reply(_("%s %s list is empty."), ci->GetName().c_str(), source.command.c_str()); + source.Reply(_("{0} {1} list is empty."), ci->GetName(), source.command); return; } @@ -432,14 +432,14 @@ class CommandCSXOP : public Command if (list.IsEmpty()) { - source.Reply(_("No matching entries on %s access list."), ci->GetName().c_str()); + source.Reply(_("No matching entries on {0} access list."), ci->GetName()); } else { std::vector<Anope::string> replies; list.Process(replies); - source.Reply(_("%s list for %s"), source.command.c_str(), ci->GetName().c_str()); + source.Reply(_("{0} list for {1}"), source.command, ci->GetName()); for (unsigned i = 0; i < replies.size(); ++i) source.Reply(replies[i]); } @@ -449,13 +449,13 @@ class CommandCSXOP : public Command { if (Anope::ReadOnly) { - source.Reply(_("Sorry, channel %s list modification is temporarily disabled."), source.command.c_str()); + source.Reply(_("Sorry, channel {0} list modification is temporarily disabled."), source.command); return; } if (!ci->GetAccessCount()) { - source.Reply(_("%s %s list is empty."), ci->GetName().c_str(), source.command.c_str()); + source.Reply(_("{0} {1} list is empty."), ci->GetName(), source.command); return; } @@ -466,7 +466,7 @@ class CommandCSXOP : public Command } bool override = !source.AccessFor(ci).HasPriv("FOUNDER"); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to clear the access list"; + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to clear the access list")); for (unsigned i = ci->GetAccessCount(); i > 0; --i) { @@ -475,12 +475,12 @@ class CommandCSXOP : public Command if (access->GetSerializableType()->GetName() != "XOPChanAccess" || source.command.upper() != access->AccessSerialize()) continue; - delete access; + access->Delete(); } EventManager::Get()->Dispatch(&Event::AccessClear::OnAccessClear, ci, source); - source.Reply(_("Channel %s %s list has been cleared."), ci->GetName().c_str(), source.command.c_str()); + source.Reply(_("Channel {0} {1} list has been cleared."), ci->GetName(), source.command); } public: @@ -494,7 +494,7 @@ class CommandCSXOP : public Command const Anope::string GetDesc(CommandSource &source) const override { - return Anope::printf(Language::Translate(source.GetAccount(), _("Modify the list of %s users")), source.command.upper().c_str()); + return Anope::Format(Language::Translate(source.GetAccount(), _("Modify the list of {0} users")), source.command.upper()); } void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override diff --git a/modules/database/flatfile.cpp b/modules/database/flatfile.cpp index 2f9d0f209..27a51539c 100644 --- a/modules/database/flatfile.cpp +++ b/modules/database/flatfile.cpp @@ -765,7 +765,7 @@ class DBFlatFile : public Module std::fstream fd(db_name.c_str(), std::ios_base::in | std::ios_base::binary); if (!fd.is_open()) { - Log(this) << "Unable to open " << db_name << " for reading!"; + logger.Log("Unable to open {0} for reading!", db_name); return EVENT_STOP; } diff --git a/modules/database/old.cpp b/modules/database/old.cpp index ef93aec66..894b9125b 100644 --- a/modules/database/old.cpp +++ b/modules/database/old.cpp @@ -355,7 +355,7 @@ static dbFILE *open_db_read(const char *service, const char *filename, int versi fp = fopen(f->filename, "rb"); if (!fp) { - Log() << "Can't read " << service << " database " << f->filename; + Anope::Logger.Log("Can't read {0} database {1}", service, f->filename); delete f; return NULL; } @@ -363,13 +363,13 @@ static dbFILE *open_db_read(const char *service, const char *filename, int versi myversion = fgetc(fp) << 24 | fgetc(fp) << 16 | fgetc(fp) << 8 | fgetc(fp); if (feof(fp)) { - Log() << "Error reading version number on " << f->filename << ": End of file detected."; + Anope::Logger.Log("Error reading version number on {0}: End of file detected.", f->filename); delete f; return NULL; } else if (myversion < version) { - Log() << "Unsuported database version (" << myversion << ") on " << f->filename << "."; + Anope::Logger.Log("Unsuported database version ({0}) on {1}.", myversion, f->filename); delete f; return NULL; } @@ -644,7 +644,7 @@ static void LoadNicks() READ(read_uint16(&u16, f)); READ(read_int16(&i16, f)); - Log(LOG_DEBUG) << "Loaded NickServ::Account " << nc->GetDisplay(); + Anope::Logger.Debug("Loaded nickserv account {0}", nc->GetDisplay()); } for (int i = 0; i < 1024; ++i) @@ -672,7 +672,7 @@ static void LoadNicks() NickServ::Account *nc = NickServ::FindAccount(core); if (nc == NULL) { - Log() << "Skipping coreless nick " << nick << " with core " << core; + Anope::Logger.Debug("Skipping coreless nick {0} with core {1}", nick, core); continue; } @@ -709,7 +709,7 @@ static void LoadNicks() if (tmpu16 & OLD_NS_NO_EXPIRE) na->SetNoExpire(true); - Log(LOG_DEBUG) << "Loaded NickServ::Nick " << na->GetNick(); + Anope::Logger.Debug("Loaded nick {0}", na->GetNick()); } close_db(f); /* End of section Ia */ @@ -735,7 +735,7 @@ static void LoadVHosts() NickServ::Nick *na = NickServ::FindNick(nick); if (na == NULL) { - Log() << "Removing vhost for non-existent nick " << nick; + Anope::Logger.Log("Removing vhost for non-existent nick {0}", nick); continue; } @@ -749,7 +749,7 @@ static void LoadVHosts() vhost->SetCreator(creator); vhost->SetCreated(vtime); - Log() << "Loaded vhost for " << na->GetNick(); + Anope::Logger.Debug("Loaded vhost for {0}", na->GetNick()); } close_db(f); @@ -787,7 +787,7 @@ static void LoadBots() if (flags & OLD_BI_PRIVATE) bi->bi->SetOperOnly(true); - Log(LOG_DEBUG) << "Loaded bot " << bi->nick; + Anope::Logger.Debug("Loaded bot {0}", bi->nick); } close_db(f); @@ -1173,7 +1173,7 @@ static void LoadChannels() continue; } - Log(LOG_DEBUG) << "Loaded channel " << ci->GetName(); + Anope::Logger.Debug("Loaded channel {0}", ci->GetName()); } close_db(f); diff --git a/modules/database/redis.cpp b/modules/database/redis.cpp index 49ab8cbd4..b6ce95241 100644 --- a/modules/database/redis.cpp +++ b/modules/database/redis.cpp @@ -278,7 +278,7 @@ void TypeLoader::OnResult(const Reply &r) Serialize::Object *obj = type->Require(id); if (obj == nullptr) { - Log(LOG_DEBUG) << "redis: Unable to require object #" << id << " of type " << type->GetName(); + Anope::Logger.Debug("Unable to require object #{0} of type {1}", id, type->GetName()); continue; } @@ -318,7 +318,7 @@ void ObjectLoader::OnResult(const Reply &r) void FieldLoader::OnResult(const Reply &r) { - Log(LOG_DEBUG_2) << "redis: Setting field " << field->serialize_name << " of object #" << obj->id << " of type " << obj->GetSerializableType()->GetName() << " to " << r.bulk; + Anope::Logger.Debug2("Setting field {0} of object #{1} of type {2} to {3}", field->serialize_name, obj->id, obj->GetSerializableType()->GetName(), r.bulk); field->UnserializeFromString(obj, r.bulk); delete this; @@ -358,25 +358,27 @@ void SubscriptionListener::OnResult(const Reply &r) } catch (const ConvertException &ex) { - Log(LOG_DEBUG) << "redis: unable to get id for SL update key " << sid; + this->GetOwner()->logger.Debug("unable to get id for SL update key {0}", sid); return; } Serialize::Object *obj = Serialize::GetID(id); if (obj == nullptr) { - Log(LOG_DEBUG) << "redis: pmessage for unknown object #" << id; + this->GetOwner()->logger.Debug("message for unknown object #{0}", id); return; } Serialize::FieldBase *field = obj->GetSerializableType()->GetField(key); if (field == nullptr) { - Log(LOG_DEBUG) << "redis: pmessage for unknown field of object #" << id << ": " << key; + this->GetOwner()->logger.Debug("message for unknown field of object #{0}: {1}", id, key); return; } - Log(LOG_DEBUG_2) << "redis: Setting field " << field->serialize_name << " of object #" << obj->id << " of type " << obj->GetSerializableType()->GetName() << " to " << value; + this->GetOwner()->logger.Debug2("Setting field {0} of object #{1} of type {2} to {3}", + field->serialize_name, obj->id, obj->GetSerializableType()->GetName(), value); + field->UnserializeFromString(obj, value); } else if (command == "create") @@ -393,21 +395,21 @@ void SubscriptionListener::OnResult(const Reply &r) } catch (const ConvertException &ex) { - Log(LOG_DEBUG) << "redis: unable to get id for SL update key " << sid; + this->GetOwner()->logger.Debug("unable to get id for SL update key {0}", sid); return; } Serialize::TypeBase *type = Serialize::TypeBase::Find(stype); if (type == nullptr) { - Log(LOG_DEBUG) << "redis: pmessage create for nonexistant type " << stype; + this->GetOwner()->logger.Debug("message create for nonexistant type {0}", stype); return; } Serialize::Object *obj = type->Require(id); if (obj == nullptr) { - Log(LOG_DEBUG) << "redis: require for pmessage create type " << type->GetName() << " id #" << id << " returned nullptr"; + this->GetOwner()->logger.Debug("require for message create type {0} id #{1} returned nullptr", type->GetName(), id); return; } } @@ -424,21 +426,23 @@ void SubscriptionListener::OnResult(const Reply &r) } catch (const ConvertException &ex) { - Log(LOG_DEBUG) << "redis: unable to get id for SL update key " << sid; + this->GetOwner()->logger.Debug("unable to get id for SL update key {0}", sid); return; } Serialize::Object *obj = Serialize::GetID(id); if (obj == nullptr) { - Log(LOG_DEBUG) << "redis: message for unknown object #" << id; + this->GetOwner()->logger.Debug("message for unknown object #{0}", id); return; } obj->Delete(); } else - Log(LOG_DEBUG) << "redis: unknown message: " << message; + { + this->GetOwner()->logger.Debug("unknown message: {0}", message); + } } MODULE_INIT(DatabaseRedis) diff --git a/modules/database/sql.cpp b/modules/database/sql.cpp index 1739f168d..00c45a4bc 100644 --- a/modules/database/sql.cpp +++ b/modules/database/sql.cpp @@ -176,7 +176,7 @@ class DBSQL : public Module, public Pipe Serialize::Object *other = type->Require(id); if (other == nullptr) { - Log(LOG_DEBUG) << "Unable to require id " << id << " type " << type->GetName(); + Anope::Logger.Debug("Unable to require id {0} type {1}", id, type->GetName()); continue; } diff --git a/modules/dns.cpp b/modules/dns.cpp index 523b4044d..62659414a 100644 --- a/modules/dns.cpp +++ b/modules/dns.cpp @@ -43,7 +43,7 @@ class Packet : public Query if (pos + name.length() + 2 > output_size) throw SocketException("Unable to pack name"); - Log(LOG_DEBUG_2) << "Resolver: PackName packing " << name; + Anope::Logger.Debug2("resolver: PackName packing {0}", name); sepstream sep(name, '.'); Anope::string token; @@ -113,7 +113,7 @@ class Packet : public Query /* Empty names are valid (root domain) */ - Log(LOG_DEBUG_2) << "Resolver: UnpackName successfully unpacked " << name; + Anope::Logger.Debug2("resolver: UnpackName successfully unpacked {0}", name); return name; } @@ -203,7 +203,7 @@ class Packet : public Query break; } - Log(LOG_DEBUG_2) << "Resolver: " << record.name << " -> " << record.rdata; + Anope::Logger.Debug2("resolver: {0} -> {1}", record.name, record.rdata); return record; } @@ -252,7 +252,7 @@ class Packet : public Query unsigned short arcount = (input[packet_pos] << 8) | input[packet_pos + 1]; packet_pos += 2; - Log(LOG_DEBUG_2) << "Resolver: qdcount: " << qdcount << " ancount: " << ancount << " nscount: " << nscount << " arcount: " << arcount; + Anope::Logger.Debug2("resolver: qdcount {0} ancount: {1} nscount: {2} arcount: {3}", qdcount, ancount, nscount, arcount); for (unsigned i = 0; i < qdcount; ++i) this->questions.push_back(this->UnpackQuestion(input, len, packet_pos)); @@ -270,7 +270,7 @@ class Packet : public Query } catch (const SocketException &ex) { - Log(LOG_DEBUG_2) << "Unable to parse ns/ar records: " << ex.GetReason(); + Anope::Logger.Debug2("Unable to parse ns/ar records: {0}", ex.GetReason()); } } @@ -500,12 +500,12 @@ class TCPSocket : public ListenSocket Client(Manager *m, TCPSocket *l, int fd, const sockaddrs &addr) : Socket(fd, l->IsIPv6()), ClientSocket(l, addr), Timer(5), manager(m), packet(NULL), length(0) { - Log(LOG_DEBUG_2) << "Resolver: New client from " << addr.addr(); + Anope::Logger.Debug2("resolver: New client from {0}", addr.addr()); } ~Client() { - Log(LOG_DEBUG_2) << "Resolver: Exiting client from " << clientaddr.addr(); + Anope::Logger.Debug2("resolver: Exiting client from {0}", clientaddr.addr()); delete packet; } @@ -521,7 +521,7 @@ class TCPSocket : public ListenSocket bool ProcessRead() override { - Log(LOG_DEBUG_2) << "Resolver: Reading from DNS TCP socket"; + Anope::Logger.Debug2("resolver: reading from DNS TCP socket"); int i = recv(this->GetFD(), reinterpret_cast<char *>(packet_buffer) + length, sizeof(packet_buffer) - length, 0); if (i <= 0) @@ -541,7 +541,7 @@ class TCPSocket : public ListenSocket bool ProcessWrite() override { - Log(LOG_DEBUG_2) << "Resolver: Writing to DNS TCP socket"; + Anope::Logger.Debug2("resolver: Writing to DNS TCP socket"); if (packet != NULL) { @@ -600,7 +600,7 @@ class UDPSocket : public ReplySocket bool ProcessRead() override { - Log(LOG_DEBUG_2) << "Resolver: Reading from DNS UDP socket"; + Anope::Logger.Debug2("resolver: Reading from DNS UDP socket"); unsigned char packet_buffer[524]; sockaddrs from_server; @@ -611,7 +611,7 @@ class UDPSocket : public ReplySocket bool ProcessWrite() override { - Log(LOG_DEBUG_2) << "Resolver: Writing to DNS UDP socket"; + Anope::Logger.Debug2("resolver: Writing to DNS UDP socket"); Packet *r = !packets.empty() ? packets.front() : NULL; if (r != NULL) @@ -651,7 +651,7 @@ class NotifySocket : public Socket if (!packet) return false; - Log(LOG_DEBUG_2) << "Resolver: Notifying slave " << packet->addr.addr(); + Anope::Logger.Debug2("resolver: Notifying slave {0}", packet->addr.addr()); try { @@ -735,7 +735,7 @@ class MyManager : public Manager, public Timer } catch (const SocketException &ex) { - Log() << "Unable to bind dns to " << ip << ":" << port << ": " << ex.GetReason(); + Anope::Logger.Log("Unable to bind dns to {0}:{1}: {2}", ip, port, ex.GetReason()); } notify = n; @@ -759,11 +759,11 @@ class MyManager : public Manager, public Timer public: void Process(Request *req) override { - Log(LOG_DEBUG_2) << "Resolver: Processing request to lookup " << req->name << ", of type " << req->type; + Anope::Logger.Debug2("resolver: Processing request to lookup {0}, of type {1}", req->name, req->type); if (req->use_cache && this->CheckCache(req)) { - Log(LOG_DEBUG_2) << "Resolver: Using cached result"; + Anope::Logger.Debug2("resolver: Using cached result"); delete req; return; } @@ -802,7 +802,7 @@ class MyManager : public Manager, public Timer } catch (const SocketException &ex) { - Log(LOG_DEBUG_2) << ex.GetReason(); + Anope::Logger.Debug2(ex.GetReason()); return true; } @@ -812,7 +812,7 @@ class MyManager : public Manager, public Timer return true; else if (recv_packet.questions.empty()) { - Log(LOG_DEBUG_2) << "Resolver: Received a question with no questions?"; + Anope::Logger.Debug2("resolver: Received a question with no questions?"); return true; } @@ -868,26 +868,26 @@ class MyManager : public Manager, public Timer if (from == NULL) { - Log(LOG_DEBUG_2) << "Resolver: Received an answer over TCP. This is not supported."; + Anope::Logger.Debug2("resolver: Received an answer over TCP. This is not supported."); return true; } else if (this->addrs != *from) { - Log(LOG_DEBUG_2) << "Resolver: Received an answer from the wrong nameserver, Bad NAT or DNS forging attempt? '" << this->addrs.addr() << "' != '" << from->addr() << "'"; + Anope::Logger.Debug2("resolver: Received an answer from the wrong nameserver, Bad NAT or DNS forging attempt? '{0}' != '{1}'", this->addrs.addr(), from->addr()); return true; } std::map<unsigned short, Request *>::iterator it = this->requests.find(recv_packet.id); if (it == this->requests.end()) { - Log(LOG_DEBUG_2) << "Resolver: Received an answer for something we didn't request"; + Anope::Logger.Debug2("resolver: Received an answer for something we didn't request"); return true; } Request *request = it->second; if (recv_packet.flags & QUERYFLAGS_OPCODE) { - Log(LOG_DEBUG_2) << "Resolver: Received a nonstandard query"; + Anope::Logger.Debug2("resolver: Received a nonstandard query"); recv_packet.error = ERROR_NONSTANDARD_QUERY; request->OnError(&recv_packet); } @@ -898,23 +898,23 @@ class MyManager : public Manager, public Timer switch (recv_packet.flags & QUERYFLAGS_RCODE) { case 1: - Log(LOG_DEBUG_2) << "Resolver: format error"; + Anope::Logger.Debug2("resolver: format error"); error = ERROR_FORMAT_ERROR; break; case 2: - Log(LOG_DEBUG_2) << "Resolver: server error"; + Anope::Logger.Debug2("resolver: server error"); error = ERROR_SERVER_FAILURE; break; case 3: - Log(LOG_DEBUG_2) << "Resolver: domain not found"; + Anope::Logger.Debug2("resolver: domain not found"); error = ERROR_DOMAIN_NOT_FOUND; break; case 4: - Log(LOG_DEBUG_2) << "Resolver: not implemented"; + Anope::Logger.Debug2("resolver: not implemented"); error = ERROR_NOT_IMPLEMENTED; break; case 5: - Log(LOG_DEBUG_2) << "Resolver: refused"; + Anope::Logger.Debug2("resolver: refused"); error = ERROR_REFUSED; break; default: @@ -926,13 +926,13 @@ class MyManager : public Manager, public Timer } else if (recv_packet.questions.empty() || recv_packet.answers.empty()) { - Log(LOG_DEBUG_2) << "Resolver: No resource records returned"; + Anope::Logger.Debug2("resolver: no resource records returned"); recv_packet.error = ERROR_NO_RECORDS; request->OnError(&recv_packet); } else { - Log(LOG_DEBUG_2) << "Resolver: Lookup complete for " << request->name; + Anope::Logger.Debug2("resolver: lookup complete for {0}", request->name); request->OnLookupComplete(&recv_packet); this->AddCache(recv_packet); } @@ -984,7 +984,7 @@ class MyManager : public Manager, public Timer void Tick(time_t now) override { - Log(LOG_DEBUG_2) << "Resolver: Purging DNS cache"; + Anope::Logger.Debug2("resolver: purging DNS cache"); for (cache_map::iterator it = this->cache.begin(), it_next; it != this->cache.end(); it = it_next) { @@ -1005,7 +1005,7 @@ class MyManager : public Manager, public Timer void AddCache(Query &r) { const ResourceRecord &rr = r.answers[0]; - Log(LOG_DEBUG_3) << "Resolver cache: added cache for " << rr.name << " -> " << rr.rdata << ", ttl: " << rr.ttl; + Anope::Logger.Debug3("resolver: cache: added cache for {0} -> {1}, ttl: {2}", rr.name, rr.rdata, rr.ttl); this->cache[r.questions[0]] = r; } @@ -1018,7 +1018,7 @@ class MyManager : public Manager, public Timer if (it != this->cache.end()) { Query &record = it->second; - Log(LOG_DEBUG_3) << "Resolver: Using cached result for " << request->name; + Anope::Logger.Debug3("resolver: Using cached result for {0}", request->name); request->OnLookupComplete(&record); return true; } @@ -1097,7 +1097,7 @@ class ModuleDNS : public Module if (server.substr(i).is_pos_number_only()) { nameserver = server.substr(i); - Log(LOG_DEBUG) << "Nameserver set to " << nameserver; + Anope::Logger.Debug("resolver: nameserver set to {0}", nameserver); success = true; break; } @@ -1110,7 +1110,7 @@ class ModuleDNS : public Module if (!success) { - Log() << "Unable to find nameserver, defaulting to 127.0.0.1"; + Anope::Logger.Log("resolver: unable to find nameserver, defaulting to 127.0.0.1"); nameserver = "127.0.0.1"; } } diff --git a/modules/dnsbl.cpp b/modules/dnsbl.cpp index f8d35bf71..6b6186028 100644 --- a/modules/dnsbl.cpp +++ b/modules/dnsbl.cpp @@ -90,7 +90,7 @@ class DNSBLResolver : public Request reason = reason.replace_all_cs("%N", Config->GetBlock("networkinfo")->Get<Anope::string>("networkname")); ServiceBot *OperServ = Config->GetClient("OperServ"); - Log(creator, "dnsbl", OperServ) << user->GetMask() << " (" << addr << ") appears in " << this->blacklist.name; + creator->logger.Category("dnsbl").Bot(OperServ).Log(_("{0} ({1}) appears in {2}"), user->GetMask(), addr, this->blacklist.name); XLine *x = Serialize::New<XLine *>(); x->SetMask("*@" + addr); @@ -207,7 +207,7 @@ class ModuleDNSBL : public Module catch (const SocketException &ex) { delete res; - Log(this) << ex.GetReason(); + logger.Log(ex.GetReason()); } } } diff --git a/modules/encryption/bcrypt.cpp b/modules/encryption/bcrypt.cpp index 622fef745..3375e4bee 100644 --- a/modules/encryption/bcrypt.cpp +++ b/modules/encryption/bcrypt.cpp @@ -906,7 +906,7 @@ class EBCRYPT : public Module EventReturn OnEncrypt(const Anope::string &src, Anope::string &dest) override { dest = "bcrypt:" + Generate(src, Salt()); - Log(LOG_DEBUG_2) << "(enc_bcrypt) hashed password from [" << src << "] to [" << dest << "]"; + logger.Debug2("hashed password from {0} to {1}", src, dest); return EVENT_ALLOW; } @@ -941,7 +941,7 @@ class EBCRYPT : public Module } catch (const ConvertException &) { - Log(this) << "Could not get the round size of a hash. This is probably a bug. Hash: " << nc->GetPassword(); + logger.Log("Could not get the round size of a hash. This is probably a bug. Hash: {0}", nc->GetPassword()); } if (ModuleManager::FindFirstOf(ENCRYPTION) != this || (hashrounds && hashrounds != rounds)) @@ -962,20 +962,20 @@ class EBCRYPT : public Module if (rounds == 0) { rounds = 10; - Log(this) << "Rounds can't be 0! Setting ignored."; + logger.Log("Rounds can't be 0! Setting ignored."); } else if (rounds < 10) { - Log(this) << "10 to 12 rounds is recommended."; + logger.Log("10 to 12 rounds is recommended."); } else if (rounds >= 32) { rounds = 10; - Log(this) << "The maximum number of rounds supported is 31. Ignoring setting and using 10."; + logger.Log("The maximum number of rounds supported is 31. Ignoring setting and using 10."); } else if (rounds >= 14) { - Log(this) << "Are you sure you want to use " << stringify(rounds) << " in your bcrypt settings? This is very CPU intensive! Recommended rounds is 10-12."; + logger.Log("Are you sure you want to use {0} in your bcrypt settings? This is very CPU intensive! Recommended rounds is 10-12.", rounds); } } }; diff --git a/modules/encryption/md5.cpp b/modules/encryption/md5.cpp index ca3bfcc9a..7dd92d92f 100644 --- a/modules/encryption/md5.cpp +++ b/modules/encryption/md5.cpp @@ -376,7 +376,7 @@ class EMD5 : public Module Anope::string buf = "md5:" + Anope::Hex(reinterpret_cast<const char *>(hash.first), hash.second); - Log(LOG_DEBUG_2) << "(enc_md5) hashed password from [" << src << "] to [" << buf << "]"; + logger.Debug2("hashed password from [{0}] to [{1}]", src, buf); dest = buf; return EVENT_ALLOW; } diff --git a/modules/encryption/none.cpp b/modules/encryption/none.cpp index 3b1f49d33..2e0ae8636 100644 --- a/modules/encryption/none.cpp +++ b/modules/encryption/none.cpp @@ -38,7 +38,7 @@ class ENone : public Module Anope::string cpass; Anope::B64Encode(src, cpass); buf += cpass; - Log(LOG_DEBUG_2) << "(enc_none) hashed password from [" << src << "] to [" << buf << "]"; + logger.Debug2("hashed password from [{0}] to [{1}]", src, buf); dest = buf; return EVENT_ALLOW; } diff --git a/modules/encryption/old.cpp b/modules/encryption/old.cpp index bfe7131bc..22065e441 100644 --- a/modules/encryption/old.cpp +++ b/modules/encryption/old.cpp @@ -92,7 +92,8 @@ class EOld : public Module Anope::string buf = "oldmd5:" + Anope::Hex(digest2, sizeof(digest2)); - Log(LOG_DEBUG_2) << "(enc_old) hashed password from [" << src << "] to [" << buf << "]"; + logger.Debug2("hashed password from [{0}] to [{1}]", src, buf); + dest = buf; delete context; return EVENT_ALLOW; diff --git a/modules/encryption/sha1.cpp b/modules/encryption/sha1.cpp index ea108f49c..1dcb2dc5e 100644 --- a/modules/encryption/sha1.cpp +++ b/modules/encryption/sha1.cpp @@ -238,7 +238,7 @@ class ESHA1 : public Module Anope::string buf = "sha1:" + Anope::Hex(reinterpret_cast<const char *>(hash.first), hash.second); - Log(LOG_DEBUG_2) << "(enc_sha1) hashed password from [" << src << "] to [" << buf << "]"; + logger.Debug2("hashed password from [{0}] to [{1}]", src, buf); dest = buf; return EVENT_ALLOW; } diff --git a/modules/encryption/sha256.cpp b/modules/encryption/sha256.cpp index e05629a50..8226cb792 100644 --- a/modules/encryption/sha256.cpp +++ b/modules/encryption/sha256.cpp @@ -302,7 +302,7 @@ class ESHA256 : public Module std::stringstream buf; buf << "sha256:" << Anope::Hex(reinterpret_cast<const char *>(hash.first), hash.second) << ":" << GetIVString(); - Log(LOG_DEBUG_2) << "(enc_sha256) hashed password from [" << src << "] to [" << buf.str() << " ]"; + logger.Debug2("hashed password from [{0}] to [{1}]", src, buf.str()); dest = buf.str(); return EVENT_ALLOW; } diff --git a/modules/extra/ldap.cpp b/modules/extra/ldap.cpp index 6d4c0bd62..b5c37d7cf 100644 --- a/modules/extra/ldap.cpp +++ b/modules/extra/ldap.cpp @@ -479,7 +479,7 @@ class ModuleLDAP : public Module, public Pipe if (i == conf->CountBlock("ldap")) { - Log(LOG_NORMAL, "ldap") << "LDAP: Removing server connection " << cname; + Log(LogType::NORMAL, "ldap") << "LDAP: Removing server connection " << cname; s->SetExitState(); s->Wakeup(); @@ -507,11 +507,11 @@ class ModuleLDAP : public Module, public Pipe ss->Start(); this->LDAPServices.insert(std::make_pair(connname, ss)); - Log(LOG_NORMAL, "ldap") << "LDAP: Successfully initialized server " << connname << " (" << server << ")"; + Log(LogType::NORMAL, "ldap") << "LDAP: Successfully initialized server " << connname << " (" << server << ")"; } catch (const LDAPException &ex) { - Log(LOG_NORMAL, "ldap") << "LDAP: " << ex.GetReason(); + Log(LogType::NORMAL, "ldap") << "LDAP: " << ex.GetReason(); } } } diff --git a/modules/extra/ldap_authentication.cpp b/modules/extra/ldap_authentication.cpp index 8160eb6e2..722284fb4 100644 --- a/modules/extra/ldap_authentication.cpp +++ b/modules/extra/ldap_authentication.cpp @@ -80,7 +80,7 @@ class IdentifyInterface : public LDAPInterface { const LDAPAttributes &attr = r.get(0); ii->dn = attr.get("dn"); - Log(LOG_DEBUG) << "m_ldap_authenticationn: binding as " << ii->dn; + Log(LogType::DEBUG) << "m_ldap_authenticationn: binding as " << ii->dn; ii->lprov->Bind(new IdentifyInterface(this->owner, ii), ii->dn, ii->req->GetPassword()); ii = NULL; @@ -99,7 +99,7 @@ class IdentifyInterface : public LDAPInterface Anope::string sf = search_filter.replace_all_cs("%account", ii->req->GetAccount()).replace_all_cs("%object_class", object_class); try { - Log(LOG_DEBUG) << "m_ldap_authentication: searching for " << sf; + Log(LogType::DEBUG) << "m_ldap_authentication: searching for " << sf; ii->lprov->Search(new IdentifyInterface(this->owner, ii), basedn, sf); ii->admin_bind = false; ii = NULL; diff --git a/modules/extra/mysql.cpp b/modules/extra/mysql.cpp index a5d1ac163..66b4ffa85 100644 --- a/modules/extra/mysql.cpp +++ b/modules/extra/mysql.cpp @@ -241,7 +241,7 @@ class ModuleSQL : public Module if (i == config->CountBlock("mysql")) { - Log(LOG_NORMAL, "mysql") << "MySQL: Removing server connection " << cname; + Log(LogType::NORMAL, "mysql") << "MySQL: Removing server connection " << cname; delete s; this->MySQLServices.erase(cname); @@ -266,11 +266,11 @@ class ModuleSQL : public Module MySQLService *ss = new MySQLService(this, connname, database, server, user, password, port); this->MySQLServices.insert(std::make_pair(connname, ss)); - Log(LOG_NORMAL, "mysql") << "MySQL: Successfully connected to server " << connname << " (" << server << ")"; + Log(LogType::NORMAL, "mysql") << "MySQL: Successfully connected to server " << connname << " (" << server << ")"; } catch (const SQL::Exception &ex) { - Log(LOG_NORMAL, "mysql") << "MySQL: " << ex.GetReason(); + Log(LogType::NORMAL, "mysql") << "MySQL: " << ex.GetReason(); } } } @@ -542,7 +542,7 @@ void MySQLService::Connect() if (!connect) throw SQL::Exception("Unable to connect to MySQL service " + this->GetName() + ": " + mysql_error(this->sql)); - Log(LOG_DEBUG) << "Successfully connected to MySQL service " << this->GetName() << " at " << this->server << ":" << this->port; + Log(LogType::DEBUG) << "Successfully connected to MySQL service " << this->GetName() << " at " << this->server << ":" << this->port; } diff --git a/modules/extra/sql_authentication.cpp b/modules/extra/sql_authentication.cpp index 98128d325..0ea457ea3 100644 --- a/modules/extra/sql_authentication.cpp +++ b/modules/extra/sql_authentication.cpp @@ -43,12 +43,12 @@ class SQLAuthenticationResult : public SQL::Interface { if (r.Rows() == 0) { - Log(LOG_DEBUG) << "m_sql_authentication: Unsuccessful authentication for " << req->GetAccount(); + Log(LogType::DEBUG) << "m_sql_authentication: Unsuccessful authentication for " << req->GetAccount(); delete this; return; } - Log(LOG_DEBUG) << "m_sql_authentication: Successful authentication for " << req->GetAccount(); + Log(LogType::DEBUG) << "m_sql_authentication: Successful authentication for " << req->GetAccount(); Anope::string email; try @@ -155,7 +155,7 @@ class ModuleSQLAuthentication : public Module this->SQL->Run(new SQLAuthenticationResult(u, req), q); - Log(LOG_DEBUG) << "m_sql_authentication: Checking authentication for " << req->GetAccount(); + Log(LogType::DEBUG) << "m_sql_authentication: Checking authentication for " << req->GetAccount(); } }; diff --git a/modules/extra/sql_log.cpp b/modules/extra/sql_log.cpp index 320350ced..d561a0fb2 100644 --- a/modules/extra/sql_log.cpp +++ b/modules/extra/sql_log.cpp @@ -79,28 +79,28 @@ class SQLLog : public Module switch (l->type) { - case LOG_ADMIN: + case LogType::ADMIN: insert.SetValue("type", "ADMIN"); break; - case LOG_OVERRIDE: + case LogType::OVERRIDE: insert.SetValue("type", "OVERRIDE"); break; - case LOG_COMMAND: + case LogType::COMMAND: insert.SetValue("type", "COMMAND"); break; - case LOG_SERVER: + case LogType::SERVER: insert.SetValue("type", "SERVER"); break; - case LOG_CHANNEL: + case LogType::CHANNEL: insert.SetValue("type", "CHANNEL"); break; - case LOG_USER: + case LogType::USER: insert.SetValue("type", "USER"); break; - case LOG_MODULE: + case LogType::MODULE: insert.SetValue("type", "MODULE"); break; - case LOG_NORMAL: + case LogType::NORMAL: insert.SetValue("type", "NORMAL"); break; default: diff --git a/modules/extra/sql_oper.cpp b/modules/extra/sql_oper.cpp index 9dfcfe772..4beb3d39f 100644 --- a/modules/extra/sql_oper.cpp +++ b/modules/extra/sql_oper.cpp @@ -55,7 +55,7 @@ class SQLOperResult : public SQL::Interface if (r.Rows() == 0) { - Log(LOG_DEBUG) << "m_sql_oper: Got 0 rows for " << user->nick; + Log(LogType::DEBUG) << "m_sql_oper: Got 0 rows for " << user->nick; Deoper(); return; } @@ -71,7 +71,7 @@ class SQLOperResult : public SQL::Interface return; } - Log(LOG_DEBUG) << "m_sql_oper: Got result for " << user->nick << ", opertype " << opertype; + Log(LogType::DEBUG) << "m_sql_oper: Got result for " << user->nick << ", opertype " << opertype; Anope::string modes; try @@ -163,7 +163,7 @@ class ModuleSQLOper : public Module this->SQL->Run(new SQLOperResult(this, u), q); - Log(LOG_DEBUG) << "m_sql_oper: Checking authentication for " << u->Account()->GetDisplay(); + Log(LogType::DEBUG) << "m_sql_oper: Checking authentication for " << u->Account()->GetDisplay(); } }; diff --git a/modules/extra/ssl_gnutls.cpp b/modules/extra/ssl_gnutls.cpp index 223b72519..eecd6825e 100644 --- a/modules/extra/ssl_gnutls.cpp +++ b/modules/extra/ssl_gnutls.cpp @@ -371,7 +371,7 @@ class GnuTLSModule : public Module delete newcred; throw; } - Log(LOG_DEBUG) << "m_ssl_gnutls: Successfully loaded DH parameters from " << dhfile; + Log(LogType::DEBUG) << "m_ssl_gnutls: Successfully loaded DH parameters from " << dhfile; } if (cred) @@ -379,7 +379,7 @@ class GnuTLSModule : public Module cred = newcred; cred->incrref(); - Log(LOG_DEBUG) << "m_ssl_gnutls: Successfully loaded certificate " << certfile << " and private key " << keyfile; + Log(LogType::DEBUG) << "m_ssl_gnutls: Successfully loaded certificate " << certfile << " and private key " << keyfile; } void OnPreServerConnect() override diff --git a/modules/extra/ssl_openssl.cpp b/modules/extra/ssl_openssl.cpp index 22f421d35..20673b5ef 100644 --- a/modules/extra/ssl_openssl.cpp +++ b/modules/extra/ssl_openssl.cpp @@ -163,7 +163,7 @@ class SSLModule : public Module if (!SSL_CTX_use_certificate_chain_file(client_ctx, this->certfile.c_str()) || !SSL_CTX_use_certificate_chain_file(server_ctx, this->certfile.c_str())) throw ConfigException("Error loading certificate"); else - Log(LOG_DEBUG) << "m_ssl_openssl: Successfully loaded certificate " << this->certfile; + Log(LogType::DEBUG) << "m_ssl_openssl: Successfully loaded certificate " << this->certfile; } else Log() << "Unable to open certificate " << this->certfile; @@ -173,7 +173,7 @@ class SSLModule : public Module if (!SSL_CTX_use_PrivateKey_file(client_ctx, this->keyfile.c_str(), SSL_FILETYPE_PEM) || !SSL_CTX_use_PrivateKey_file(server_ctx, this->keyfile.c_str(), SSL_FILETYPE_PEM)) throw ConfigException("Error loading private key"); else - Log(LOG_DEBUG) << "m_ssl_openssl: Successfully loaded private key " << this->keyfile; + Log(LogType::DEBUG) << "m_ssl_openssl: Successfully loaded private key " << this->keyfile; } else { diff --git a/modules/extra/stats/chanstats.cpp b/modules/extra/stats/chanstats.cpp index 65a198449..adc002c8c 100644 --- a/modules/extra/stats/chanstats.cpp +++ b/modules/extra/stats/chanstats.cpp @@ -34,11 +34,11 @@ class CommandCSSetChanstats : public Command { ci->Extend<bool>("CS_STATS"); source.Reply(_("Chanstats statistics are now enabled for this channel.")); - Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable chanstats"; + Log(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, this, ci) << "to enable chanstats"; } else if (params[1].equals_ci("OFF")) { - Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable chanstats"; + Log(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, this, ci) << "to disable chanstats"; ci->Shrink<bool>("CS_STATS"); source.Reply(_("Chanstats statistics are now disabled for this channel.")); } @@ -79,7 +79,7 @@ class CommandNSSetChanstats : public Command if (param.equals_ci("ON")) { - Log(na->GetAccount() == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to enable chanstats for " << na->GetAccount()->GetDisplay(); + Log(na->GetAccount() == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, this) << "to enable chanstats for " << na->GetAccount()->GetDisplay(); na->GetAccount()->Extend<bool>("NS_STATS"); if (saset) source.Reply(_("Chanstats statistics are now enabled for %s"), na->GetAccount()->GetDisplay().c_str()); @@ -88,7 +88,7 @@ class CommandNSSetChanstats : public Command } else if (param.equals_ci("OFF")) { - Log(na->GetAccount() == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to disable chanstats for " << na->GetAccount()->GetDisplay(); + Log(na->GetAccount() == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, this) << "to disable chanstats for " << na->GetAccount()->GetDisplay(); na->GetAccount()->Shrink<bool>("NS_STATS"); if (saset) source.Reply(_("Chanstats statistics are now disabled for %s"), na->GetAccount()->GetDisplay().c_str()); @@ -148,9 +148,9 @@ class MySQLInterface : public SQL::Interface void OnError(const SQL::Result &r) override { if (!r.GetQuery().query.empty()) - Log(LOG_DEBUG) << "Chanstats: Error executing query " << r.finished_query << ": " << r.GetError(); + Log(LogType::DEBUG) << "Chanstats: Error executing query " << r.finished_query << ": " << r.GetError(); else - Log(LOG_DEBUG) << "Chanstats: Error executing query: " << r.GetError(); + Log(LogType::DEBUG) << "Chanstats: Error executing query: " << r.GetError(); } }; diff --git a/modules/extra/stats/cs_fantasy_stats.cpp b/modules/extra/stats/cs_fantasy_stats.cpp index 78dce14f1..1cbc4cd15 100644 --- a/modules/extra/stats/cs_fantasy_stats.cpp +++ b/modules/extra/stats/cs_fantasy_stats.cpp @@ -24,9 +24,9 @@ class MySQLInterface : public SQL::Interface void OnError(const SQL::Result &r) override { if (!r.GetQuery().query.empty()) - Log(LOG_DEBUG) << "Chanstats: Error executing query " << r.finished_query << ": " << r.GetError(); + Log(LogType::DEBUG) << "Chanstats: Error executing query " << r.finished_query << ": " << r.GetError(); else - Log(LOG_DEBUG) << "Chanstats: Error executing query: " << r.GetError(); + Log(LogType::DEBUG) << "Chanstats: Error executing query: " << r.GetError(); } }; @@ -157,7 +157,7 @@ class CSStats : public Module } catch (const SQL::Exception &ex) { - Log(LOG_DEBUG) << ex.GetReason(); + Log(LogType::DEBUG) << ex.GetReason(); } } diff --git a/modules/extra/stats/cs_fantasy_top.cpp b/modules/extra/stats/cs_fantasy_top.cpp index 961b2f903..2be1d2f1c 100644 --- a/modules/extra/stats/cs_fantasy_top.cpp +++ b/modules/extra/stats/cs_fantasy_top.cpp @@ -24,9 +24,9 @@ class MySQLInterface : public SQL::Interface void OnError(const SQL::Result &r) override { if (!r.GetQuery().query.empty()) - Log(LOG_DEBUG) << "Chanstats: Error executing query " << r.finished_query << ": " << r.GetError(); + Log(LogType::DEBUG) << "Chanstats: Error executing query " << r.finished_query << ": " << r.GetError(); else - Log(LOG_DEBUG) << "Chanstats: Error executing query: " << r.GetError(); + Log(LogType::DEBUG) << "Chanstats: Error executing query: " << r.GetError(); } }; @@ -160,7 +160,7 @@ class CSTop : public Module } catch (const SQL::Exception &ex) { - Log(LOG_DEBUG) << ex.GetReason(); + Log(LogType::DEBUG) << ex.GetReason(); } } }; diff --git a/modules/fantasy.cpp b/modules/fantasy.cpp index 63fa7c5c5..7a9ea99f8 100644 --- a/modules/fantasy.cpp +++ b/modules/fantasy.cpp @@ -56,7 +56,7 @@ class CommandBSSetFantasy : public Command if (value.equals_ci("ON")) { bool override = !source.AccessFor(ci).HasPriv("SET"); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enable fantasy"; + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to enable fantasy")); ci->SetFantasy(true); source.Reply(_("Fantasy mode is now \002on\002 on channel \002{0}\002."), ci->GetName()); @@ -64,7 +64,7 @@ class CommandBSSetFantasy : public Command else if (value.equals_ci("OFF")) { bool override = !source.AccessFor(ci).HasPriv("SET"); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to disable fantasy"; + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to disable fantasy")); ci->SetFantasy(false); source.Reply(_("Fantasy mode is now \002off\002 on channel \002{0}\002."), ci->GetName()); @@ -161,7 +161,7 @@ class Fantasy : public Module ServiceReference<Command> cmd(info.name); if (!cmd) { - Log(LOG_DEBUG) << "Fantasy command " << it->first << " exists for non-existent service " << info.name << "!"; + logger.Debug("Fantasy command {0} exists for non-existent service {1}!", it->first, info.name); return; } diff --git a/modules/global/global.cpp b/modules/global/global.cpp index af4add942..1d7ff7073 100644 --- a/modules/global/global.cpp +++ b/modules/global/global.cpp @@ -41,7 +41,8 @@ class CommandGLGlobal : public Command return; } - Log(LOG_ADMIN, source, this); + logger.Command(LogType::ADMIN, source, _("{source} used {command} to send {0}"), msg); + service->SendGlobal(NULL, source.GetNick(), msg); } diff --git a/modules/greet.cpp b/modules/greet.cpp index 58d37d4c4..52591f7f5 100644 --- a/modules/greet.cpp +++ b/modules/greet.cpp @@ -58,7 +58,7 @@ class CommandBSSetGreet : public Command if (value.equals_ci("ON")) { bool override = !source.AccessFor(ci).HasPriv("SET"); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enable greets"; + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to enable greets")); ci->SetGreet(true); source.Reply(_("Greet mode for \002{0}\002 is now \002on\002."), ci->GetName()); @@ -66,7 +66,7 @@ class CommandBSSetGreet : public Command else if (value.equals_ci("OFF")) { bool override = !source.AccessFor(ci).HasPriv("SET"); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to disable greets"; + logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to disable greets")); ci->SetGreet(false); source.Reply(_("Greet mode for \002{0}\002 is now \002off\002."), ci->GetName()); @@ -115,13 +115,15 @@ class CommandNSSetGreet : public Command if (!param.empty()) { - Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to change the greet of " << nc->GetDisplay(); + logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, _("{source} used {command} to change the greet of {0}"), nc->GetDisplay()); + nc->SetGreet(param); source.Reply(_("Greet message for \002{0}\002 changed to \002{1}\002."), nc->GetDisplay(), param); } else { - Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to unset the greet of " << nc->GetDisplay(); + logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, _("{source} used {command} to unset the greet of {0}"), nc->GetDisplay()); + nc->SetGreet(""); source.Reply(_("Greet message for \002{0}\002 unset."), nc->GetDisplay()); } diff --git a/modules/hostserv/add.cpp b/modules/hostserv/add.cpp index f9388c975..3448dbc41 100644 --- a/modules/hostserv/add.cpp +++ b/modules/hostserv/add.cpp @@ -101,7 +101,7 @@ class CommandHSAdd : public Command } Anope::string mask = (!user.empty() ? user + "@" : "") + host; - Log(LOG_ADMIN, source, this) << "to add the vhost " << mask << " to " << na->GetAccount()->GetDisplay(); + logger.Command(LogType::ADMIN, source, _("{source} used {command} to add the vhost {0} to {1}"), mask, na->GetAccount()->GetDisplay()); HostServ::VHost *vhost = Serialize::New<HostServ::VHost *>(); if (vhost == nullptr) diff --git a/modules/hostserv/del.cpp b/modules/hostserv/del.cpp index 4d754ac1b..a72c61c9a 100644 --- a/modules/hostserv/del.cpp +++ b/modules/hostserv/del.cpp @@ -54,7 +54,7 @@ class CommandHSDel : public Command return; } - Log(LOG_ADMIN, source, this) << "on " << na->GetAccount()->GetDisplay() << " to remove vhost " << vhost->Mask(); + logger.Command(LogType::ADMIN, source, _("{source} used {command} on {0} to remove vhost {1}"), na->GetAccount()->GetDisplay(), vhost->Mask()); source.Reply(_("Vhost \002{0}\002 for \002{1}\002 has been removed."), vhost->Mask(), na->GetAccount()->GetDisplay()); vhost->Delete(); return; @@ -67,7 +67,8 @@ class CommandHSDel : public Command return; } - Log(LOG_ADMIN, source, this) << "on " << na->GetAccount()->GetDisplay(); + logger.Command(LogType::ADMIN, source, _("{source} used {command} on {0}"), na->GetAccount()->GetDisplay()); + #warning "send account" EventManager::Get()->Dispatch(&Event::DeleteVhost::OnDeleteVhost, na); diff --git a/modules/hostserv/off.cpp b/modules/hostserv/off.cpp index e1af7def4..861fd00b8 100644 --- a/modules/hostserv/off.cpp +++ b/modules/hostserv/off.cpp @@ -43,7 +43,7 @@ class CommandHSOff : public Command // XXX vident? u->vhost.clear(); IRCD->Send<messages::VhostDel>(u); - Log(LOG_COMMAND, source, this) << "to disable their vhost"; + logger.Command(LogType::ADMIN, source, _("{source} used {command} to disable their vhost")); source.Reply(_("Your vhost was removed and the normal cloaking restored.")); } diff --git a/modules/hostserv/on.cpp b/modules/hostserv/on.cpp index 3041f65a5..556b2f567 100644 --- a/modules/hostserv/on.cpp +++ b/modules/hostserv/on.cpp @@ -59,7 +59,7 @@ class CommandHSOn : public Command source.Reply(_("Your vhost of \002{0}\002 is now activated."), vhost->Mask()); - Log(LOG_COMMAND, source, this) << "to enable their vhost of " << vhost->Mask(); + logger.Command(LogType::ADMIN, source, _("{source} used {command} to enable their vhost of {0}"), vhost->Mask()); IRCD->Send<messages::VhostSet>(u, vhost->GetIdent(), vhost->GetHost()); u->vhost = vhost->GetHost(); if (IRCD->CanSetVIdent && !vhost->GetIdent().empty()) diff --git a/modules/hostserv/request.cpp b/modules/hostserv/request.cpp index 9508a9abc..bef1f1548 100644 --- a/modules/hostserv/request.cpp +++ b/modules/hostserv/request.cpp @@ -232,7 +232,7 @@ class CommandHSRequest : public Command source.Reply(_("Your vhost has been requested.")); this->SendMemos(source, user, host); - Log(LOG_COMMAND, source, this) << "to request new vhost " << (!user.empty() ? user + "@" : "") << host; + logger.Command(LogType::COMMAND, source, _("{source} used {command} to request new vhost {0}"), (!user.empty() ? user + "@" : "") + host); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override @@ -303,7 +303,8 @@ class CommandHSActivate : public Command memoserv->Send(source.service->nick, na->GetNick(), _("[auto memo] Your requested vHost has been approved."), true); source.Reply(_("Vhost for \002{0}\002 has been activated."), na->GetNick()); - Log(LOG_COMMAND, source, this) << "for " << na->GetNick() << " for vhost " << (!req->GetIdent().empty() ? req->GetIdent() + "@" : "") << req->GetHost(); + logger.Command(LogType::COMMAND, source, _("{source} used {command} for {0} for vhost {1}"), + na->GetNick(), (!req->GetIdent().empty() ? req->GetIdent() + "@" : "") + req->GetHost()); req->Delete(); } @@ -367,7 +368,8 @@ class CommandHSReject : public Command } source.Reply(_("Vhost for \002{0}\002 has been rejected."), na->GetNick()); - Log(LOG_COMMAND, source, this) << "to reject vhost for " << nick << " (" << (!reason.empty() ? reason : "no reason") << ")"; + logger.Command(LogType::COMMAND, source, _("{source} used {command} to reject vhost for {0} ({1})"), + na->GetNick(), !reason.empty() ? reason : "no reason"); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override diff --git a/modules/hostserv/set.cpp b/modules/hostserv/set.cpp index f66c42d8a..8162fa80d 100644 --- a/modules/hostserv/set.cpp +++ b/modules/hostserv/set.cpp @@ -113,6 +113,8 @@ class CommandHSSetDefault : public Command vhost->SetDefault(true); source.Reply(_("Your default vhost is now \002{0}\002."), vhost->Mask()); + + logger.Command(LogType::COMMAND, source, _("{source} used {command} set their default vhost to {0}"), vhost->Mask()); } bool OnHelp(CommandSource &source, const Anope::string &) override diff --git a/modules/httpd.cpp b/modules/httpd.cpp index 41cd4a4ec..cdbca9d05 100644 --- a/modules/httpd.cpp +++ b/modules/httpd.cpp @@ -84,13 +84,13 @@ class MyHTTPClient : public HTTPClient if (this->message.headers.count(token)) { this->ip = this->message.headers[token]; - Log(LOG_DEBUG, "httpd") << "m_httpd: IP for connection " << this->GetFD() << " changed to " << this->ip; + Anope::Logger.Category("httpd").Debug("IP for connection {0} changed to {1}", this->GetFD(), this->ip); break; } } } - Log(LOG_DEBUG, "httpd") << "m_httpd: Serving page " << this->page_name << " to " << this->ip; + Anope::Logger.Category("httpd").Debug("Serving page {0} to {1}", this->page_name, this->ip); HTTPReply reply; reply.content_type = this->page->GetContentType(); @@ -104,12 +104,12 @@ class MyHTTPClient : public HTTPClient MyHTTPClient(HTTPProvider *l, int f, const sockaddrs &a) : Socket(f, l->IsIPv6()), HTTPClient(l, f, a), provider(l), header_done(false), served(false), ip(a.addr()), content_length(0), created(Anope::CurTime) { - Log(LOG_DEBUG, "httpd") << "Accepted connection " << f << " from " << a.addr(); + Anope::Logger.Category("httpd").Debug("Accepted connection {0} from {1}", f, a.addr()); } ~MyHTTPClient() { - Log(LOG_DEBUG, "httpd") << "Closing connection " << this->GetFD() << " from " << this->ip; + Anope::Logger.Category("httpd").Debug("Closing connection {0} from {1}", this->GetFD(), this->ip); } /* Close connection once all data is written */ @@ -152,7 +152,7 @@ class MyHTTPClient : public HTTPClient if (sz == Anope::string::npos || !sz || sz + 1 >= token.length()) continue; this->message.post_data[token.substr(0, sz)] = HTTPUtils::URLDecode(token.substr(sz + 1)); - Log(LOG_DEBUG_2) << "HTTP POST from " << this->clientaddr.addr() << ": " << token.substr(0, sz) << ": " << this->message.post_data[token.substr(0, sz)]; + Anope::Logger.Debug2("HTTP POST from {0}: {1}: {2}", this->clientaddr.addr(), token.substr(0, sz), this->message.post_data[token.substr(0, sz)]); } this->Serve(); @@ -163,7 +163,7 @@ class MyHTTPClient : public HTTPClient bool Read(const Anope::string &buf) { - Log(LOG_DEBUG_2) << "HTTP from " << this->clientaddr.addr() << ": " << buf; + Anope::Logger.Debug2("HTTP from {0}: {1}", this->clientaddr.addr(), buf); if (message.method == httpd::Method::NONE) { @@ -409,12 +409,12 @@ class HTTPD : public Module if (ip.empty()) { - Log(this) << "You must configure a bind IP for HTTP server " << hname; + logger.Log("You must configure a bind IP for HTTP server {0}", hname); continue; } else if (port <= 0 || port > 65535) { - Log(this) << "You must configure a (valid) listen port for HTTP server " << hname; + logger.Log("You must configure a (valid) listen port for HTTP server {0}", hname); continue; } @@ -429,12 +429,12 @@ class HTTPD : public Module } catch (const SocketException &ex) { - Log(this) << "Unable to create HTTP server " << hname << ": " << ex.GetReason(); + logger.Log("Unable to create HTTP server {0}: {1}", hname, ex.GetReason()); continue; } this->providers[hname] = p; - Log(this) << "Created HTTP server " << hname; + logger.Log("Created HTTP server {0}", hname); } else { @@ -445,7 +445,7 @@ class HTTPD : public Module delete p; this->providers.erase(hname); - Log(this) << "Changing HTTP server " << hname << " to " << ip << ":" << port; + logger.Log("Changing HTTP server {0} to {1}:{2}", hname, ip, port); try { @@ -455,7 +455,7 @@ class HTTPD : public Module } catch (const SocketException &ex) { - Log(this) << "Unable to create HTTP server " << hname << ": " << ex.GetReason(); + logger.Log("Unable to create HTTP server {0}: {1}", hname, ex.GetReason()); continue; } @@ -475,7 +475,7 @@ class HTTPD : public Module if (existing.count(p->GetName()) == 0) { - Log(this) << "Removing HTTP server " << p->GetName(); + logger.Log("Removing HTTP server {0}", p->GetName()); this->providers.erase(p->GetName()); delete p; } diff --git a/modules/memoserv/send.cpp b/modules/memoserv/send.cpp index 4cdbc0eb3..fdde189f9 100644 --- a/modules/memoserv/send.cpp +++ b/modules/memoserv/send.cpp @@ -53,7 +53,7 @@ class CommandMSSend : public Command if (result == MemoServ::MemoServService::MEMO_SUCCESS) { source.Reply(_("Memo sent to \002%s\002."), nick.c_str()); - Log(LOG_COMMAND, source, this) << "to send a memo to " << nick; + logger.Command(LogType::COMMAND, source, _("{source} used {command} to send a memo to {0}"), nick); } else if (result == MemoServ::MemoServService::MEMO_INVALID_TARGET) { diff --git a/modules/memoserv/sendall.cpp b/modules/memoserv/sendall.cpp index 9ab2a649e..d0b815560 100644 --- a/modules/memoserv/sendall.cpp +++ b/modules/memoserv/sendall.cpp @@ -36,7 +36,7 @@ class CommandMSSendAll : public Command const Anope::string &text = params[0]; - Log(LOG_ADMIN, source, this) << "to send " << text; + logger.Command(LogType::ADMIN, source, _("{source} used {command} to send {0}"), text); for (NickServ::Account *nc : NickServ::service->GetAccountList()) if (nc != source.nc) diff --git a/modules/nickserv/access.cpp b/modules/nickserv/access.cpp index e20d81037..8c6ac0343 100644 --- a/modules/nickserv/access.cpp +++ b/modules/nickserv/access.cpp @@ -107,7 +107,7 @@ class CommandNSAccess : public Command a->SetAccount(nc); a->SetMask(mask); - Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to ADD mask " << mask << " to " << nc->GetDisplay(); + logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, _("{source} used {command} to add mask {0} to {1}"), mask, nc->GetDisplay()); source.Reply(_("\002{0}\002 added to the access list of \002{1}\002."), mask, nc->GetDisplay()); } @@ -129,7 +129,9 @@ class CommandNSAccess : public Command if (a->GetMask().equals_ci(mask)) { a->Delete(); - Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to DELETE mask " << mask << " from " << nc->GetDisplay(); + logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, + _("{source} used {command} to delete mask {0} from {1}"), + mask, nc->GetDisplay()); source.Reply(_("\002{0}\002 deleted from the access list of \002{1}\002."), mask, nc->GetDisplay()); return; } @@ -264,7 +266,7 @@ class NSAccess : public Module { NickAccess *a = Serialize::New<NickAccess *>(); a->SetAccount(na->GetAccount()); - a->SetMask(u->Mask()); + a->SetMask(u->WildMask()); u->SendMessage(Config->GetClient("NickServ"), _("\002{0}\002 has been registered under your hostmask: \002{1}\002"), na->GetNick(), a->GetMask()); diff --git a/modules/nickserv/ajoin.cpp b/modules/nickserv/ajoin.cpp index 0d708143c..bdb6c0522 100644 --- a/modules/nickserv/ajoin.cpp +++ b/modules/nickserv/ajoin.cpp @@ -181,7 +181,7 @@ class CommandNSAJoin : public Command return; addedchans = addedchans.substr(0, addedchans.length() - 2); - Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to ADD channel " << addedchans << " to " << nc->GetDisplay(); + logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, _("{source} used {command} to add channel {2} from {3}"), addedchans, nc->GetDisplay()); source.Reply(_("\002{0}\002 added to the auto join list of \002{1}\002."), addedchans, nc->GetDisplay()); } @@ -218,7 +218,7 @@ class CommandNSAJoin : public Command return; delchans = delchans.substr(0, delchans.length() - 2); - Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to DELETE channel " << delchans << " from " << nc->GetDisplay(); + logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, _("{source} used {command} to delete channel {2} from {3}"), delchans, nc->GetDisplay()); source.Reply(_("\002{0}\002 was removed from the auto join list of \002{1}\002."), delchans, nc->GetDisplay()); } diff --git a/modules/nickserv/cert.cpp b/modules/nickserv/cert.cpp index 51eae0fb0..d2e91bce6 100644 --- a/modules/nickserv/cert.cpp +++ b/modules/nickserv/cert.cpp @@ -187,8 +187,8 @@ class CommandNSCert : public Command e->SetCert(certfp); #warning "events?" + logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, _("{source} used {command} to add certificate fingerprint {0} to {1}"), certfp, nc->GetDisplay()); - Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to ADD certificate fingerprint " << certfp << " to " << nc->GetDisplay(); source.Reply(_("\002{0}\002 added to the certificate list of \002{1}\002."), certfp, nc->GetDisplay()); } @@ -218,7 +218,7 @@ class CommandNSCert : public Command cert->Delete(); - Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to DELETE certificate fingerprint " << certfp << " from " << nc->GetDisplay(); + logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, _("{source} used {command} to delete certificate fingerprint {0} from {1}"), certfp, nc->GetDisplay()); source.Reply(_("\002{0}\002 deleted from the access list of \002{1}\002."), certfp, nc->GetDisplay()); } @@ -354,8 +354,9 @@ class NSCert : public Module else u->Login(nc); - u->SendMessage(NickServ, _("SSL certificate fingerprint accepted, you are now identified to \002%s\002."), nc->GetDisplay().c_str()); - Log(NickServ) << u->GetMask() << " automatically identified for account " << nc->GetDisplay() << " via SSL certificate fingerprint"; + u->SendMessage(NickServ, _("SSL certificate fingerprint accepted, you are now identified to \002{0}\002."), nc->GetDisplay()); + NickServ->logger.Log(_("{0} automatically identified for account {1} via SSL certificate fingerprint"), + u->GetMask(), nc->GetDisplay()); } EventReturn OnNickValidate(User *u, NickServ::Nick *na) override @@ -376,7 +377,8 @@ class NSCert : public Module u->Identify(na); u->SendMessage(NickServ, _("SSL certificate fingerprint accepted, you are now identified.")); - Log(NickServ) << u->GetMask() << " automatically identified for account " << na->GetAccount()->GetDisplay() << " via SSL certificate fingerprint"; + NickServ->logger.Log(_("{0} automatically identified for account {1} via SSL certificate fingerprint"), + u->GetMask(), na->GetAccount()->GetDisplay()); return EVENT_ALLOW; } diff --git a/modules/nickserv/drop.cpp b/modules/nickserv/drop.cpp index 426e3115e..d5a3f77b7 100644 --- a/modules/nickserv/drop.cpp +++ b/modules/nickserv/drop.cpp @@ -63,7 +63,10 @@ class CommandNSDrop : public Command EventManager::Get()->Dispatch(&Event::NickDrop::OnNickDrop, source, na); - Log(!is_mine ? LOG_ADMIN : LOG_COMMAND, source, this) << "to drop nickname " << na->GetNick() << " (group: " << na->GetAccount()->GetDisplay() << ") (email: " << (!na->GetAccount()->GetEmail().empty() ? na->GetAccount()->GetEmail() : "none") << ")"; + logger.Command(!is_mine ? LogType::ADMIN : LogType::COMMAND, source, _("{source} used {command} to drop nickname {0} (account: {1}) (e-mail: {2})"), + na->GetNick(), na->GetAccount()->GetDisplay(), + !na->GetAccount()->GetEmail().empty() ? na->GetAccount()->GetEmail() : "none"); + na->Delete(); source.Reply(_("\002{0}\002 has been dropped."), nick); diff --git a/modules/nickserv/getemail.cpp b/modules/nickserv/getemail.cpp index 0a996e7b0..ff7f9e8c1 100644 --- a/modules/nickserv/getemail.cpp +++ b/modules/nickserv/getemail.cpp @@ -33,7 +33,7 @@ class CommandNSGetEMail : public Command const Anope::string &email = params[0]; int j = 0; - Log(LOG_ADMIN, source, this) << "on " << email; + logger.Command(LogType::ADMIN, source, _("{source} used {command} on {0}"), email); for (NickServ::Account *nc : NickServ::service->GetAccountList()) if (!nc->GetEmail().empty() && Anope::Match(nc->GetEmail(), email)) diff --git a/modules/nickserv/group.cpp b/modules/nickserv/group.cpp index f5afb272e..cff53d320 100644 --- a/modules/nickserv/group.cpp +++ b/modules/nickserv/group.cpp @@ -56,7 +56,10 @@ class NSGroupRequestListener : public NickServ::IdentifyRequestListener u->Login(target->GetAccount()); EventManager::Get()->Dispatch(&Event::NickGroup::OnNickGroup, u, target); - Log(LOG_COMMAND, source, cmd) << "to make " << nick << " join group of " << target->GetNick() << " (" << target->GetAccount()->GetDisplay() << ") (email: " << (!target->GetAccount()->GetEmail().empty() ? target->GetAccount()->GetEmail() : "none") << ")"; + cmd->logger.Command(LogType::COMMAND, source, _("{source} used {command} to make {2} join group of {3} ({4}) (email: {5})"), + source.GetSource(), source.GetCommand(), nick, target->GetNick(), target->GetAccount()->GetDisplay(), + !target->GetAccount()->GetEmail().empty() ? target->GetAccount()->GetEmail() : "none"); + source.Reply(_("You are now in the group of \002{0}\002."), target->GetNick()); u->lastnickreg = Anope::CurTime; @@ -68,7 +71,7 @@ class NSGroupRequestListener : public NickServ::IdentifyRequestListener if (!source.GetUser()) return; - Log(LOG_COMMAND, source, cmd) << "and failed to group to " << target->GetNick(); + cmd->logger.Command(LogType::COMMAND, source, _("{source} used {command} and failed to group to {0}"), target->GetNick()); source.Reply(_("Password incorrect.")); source.GetUser()->BadPassword(); } @@ -149,7 +152,8 @@ class CommandNSGroup : public Command if (target->GetAccount()->HasFieldS("NS_SUSPENDED")) { - Log(LOG_COMMAND, source, this) << "and tried to group to suspended nick " << target->GetNick(); + logger.Command(LogType::COMMAND, source, _("{source} used {command} and tried to group to suspended nickname {0}"), target->GetNick()); + source.Reply(_("\002{0}\002 is suspended."), target->GetNick()); return; } diff --git a/modules/nickserv/identify.cpp b/modules/nickserv/identify.cpp index 13e578b69..a88c9c90b 100644 --- a/modules/nickserv/identify.cpp +++ b/modules/nickserv/identify.cpp @@ -42,9 +42,10 @@ class NSIdentifyRequestListener : public NickServ::IdentifyRequestListener } if (u->IsIdentified()) - Log(LOG_COMMAND, source, cmd) << "to log out of account " << u->Account()->GetDisplay(); + cmd->logger.Command(LogType::COMMAND, source, _("{source} used {command} to log out of account {0}"), u->Account()->GetDisplay()); + + cmd->logger.Command(LogType::COMMAND, source, _("{source} used {command} and identified for account {0}"), na->GetAccount()->GetDisplay()); - Log(LOG_COMMAND, source, cmd) << "and identified for account " << na->GetAccount()->GetDisplay(); source.Reply(_("Password accepted - you are now recognized as \002{0}\002."), na->GetAccount()->GetDisplay()); u->Identify(na); } @@ -55,14 +56,20 @@ class NSIdentifyRequestListener : public NickServ::IdentifyRequestListener return; bool accountexists = NickServ::FindNick(req->GetAccount()) != NULL; - Log(LOG_COMMAND, source, cmd) << "and failed to identify to" << (accountexists ? " " : " nonexistent ") << "account " << req->GetAccount(); + if (!accountexists) + cmd->logger.Command(LogType::COMMAND, source, _("{source} used {command} and failed to identify to nonexistent account {0}"), req->GetAccount()); + else + cmd->logger.Command(LogType::COMMAND, source, _("{source} used {command} and failed to identify to account {0}"), req->GetAccount()); + if (accountexists) { source.Reply(_("Password incorrect.")); source.GetUser()->BadPassword(); } else + { source.Reply("\002{0}\002 isn't registered.", req->GetAccount()); + } } }; diff --git a/modules/nickserv/info.cpp b/modules/nickserv/info.cpp index 0fd4169e9..eb9b103fa 100644 --- a/modules/nickserv/info.cpp +++ b/modules/nickserv/info.cpp @@ -194,13 +194,19 @@ class CommandNSSetHide : public Command if (arg.equals_ci("ON")) { - Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to change hide " << param.upper() << " to " << arg.upper() << " for " << nc->GetDisplay(); + logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, + _("{source} used {command} to change hide {0} to {1} for {2}"), + param.upper(), arg.upper(), nc->GetDisplay()); + nc->SetS<bool>(flag, true); source.Reply(onmsg, nc->GetDisplay(), source.service->nick); } else if (arg.equals_ci("OFF")) { - Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to change hide " << param.upper() << " to " << arg.upper() << " for " << nc->GetDisplay(); + logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, + _("{source} used {command} to change hide {0} to {1} for {2}"), + param.upper(), arg.upper(), nc->GetDisplay()); + nc->UnsetS<bool>(flag); source.Reply(offmsg, nc->GetDisplay(), source.service->nick); } diff --git a/modules/nickserv/list.cpp b/modules/nickserv/list.cpp index 735df7d7d..e8d340683 100644 --- a/modules/nickserv/list.cpp +++ b/modules/nickserv/list.cpp @@ -213,13 +213,17 @@ class CommandNSSetPrivate : public Command if (param.equals_ci("ON")) { - Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to enable private for " << nc->GetDisplay(); + logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, + _("{source} used {command} to enable private for {0}"), nc->GetDisplay()); + nc->SetPrivate(true); source.Reply(_("Private option is now \002on\002 for \002{0}\002."), nc->GetDisplay()); } else if (param.equals_ci("OFF")) { - Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to disable private for " << nc->GetDisplay(); + logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, + _("{source} used {command} to disable private for {0}"), nc->GetDisplay()); + nc->SetPrivate(true); source.Reply(_("Private option is now \002off\002 for \002{0}\002."), nc->GetDisplay()); } diff --git a/modules/nickserv/logout.cpp b/modules/nickserv/logout.cpp index 0e6cdb46a..3cff5e9e8 100644 --- a/modules/nickserv/logout.cpp +++ b/modules/nickserv/logout.cpp @@ -61,7 +61,9 @@ class CommandNSLogout : public Command #endif u2->super_admin = false; /* Dont let people logout and remain a SuperAdmin */ - Log(LOG_COMMAND, source, this) << "to logout " << u2->nick; + + // XXX show account name here? + logger.Command(LogType::COMMAND, source, _("{source} used {command} to logout {0}"), u2->nick); if (!nick.empty()) source.Reply(_("\002{0}\002 has been logged out."), nick); diff --git a/modules/nickserv/main/account.cpp b/modules/nickserv/main/account.cpp index a6fa19adf..86c96b14f 100644 --- a/modules/nickserv/main/account.cpp +++ b/modules/nickserv/main/account.cpp @@ -283,7 +283,7 @@ void AccountImpl::SetDisplay(NickServ::Nick *na) NickServ::Account* &nc = map[this->GetDisplay()]; if (nc) - Log(LOG_DEBUG) << "Duplicate account " << this->GetDisplay() << " in nickcore table?"; + Anope::Logger.Debug("Duplicate account {0} in nickcore table?", this->GetDisplay()); nc = this; } diff --git a/modules/nickserv/main/nickserv.cpp b/modules/nickserv/main/nickserv.cpp index 3741d119b..3921534c9 100644 --- a/modules/nickserv/main/nickserv.cpp +++ b/modules/nickserv/main/nickserv.cpp @@ -426,7 +426,7 @@ class NickServCore : public Module, public NickServ::NickServService void OnDelCore(NickServ::Account *nc) override { - Log(NickServ, "nick") << "Deleting nickname group " << nc->GetDisplay(); + NickServ->logger.Category("nick").Log(_("Deleting nickname group {0}"), nc->GetDisplay()); /* Clean up this nick core from any users online */ for (unsigned int i = nc->users.size(); i > 0; --i) @@ -441,7 +441,7 @@ class NickServCore : public Module, public NickServ::NickServService void OnChangeCoreDisplay(NickServ::Account *nc, const Anope::string &newdisplay) override { - Log(LOG_NORMAL, "nick", NickServ) << "Changing " << nc->GetDisplay() << " nickname group display to " << newdisplay; + Anope::Logger.Bot(NickServ).Category("nick").Log(_("Changing {0} nickname group display to {1}"), nc->GetDisplay(), newdisplay); } void OnNickIdentify(User *u) override @@ -555,7 +555,7 @@ class NickServCore : public Module, public NickServ::NickServService IRCD->Send<messages::Login>(u, na); if (!Config->GetModule("nickserv/main")->Get<bool>("nonicknameownership") && na->GetAccount() == u->Account() && !na->GetAccount()->IsUnconfirmed()) u->SetMode(NickServ, "REGISTERED"); - Log(u, "", NickServ) << u->GetMask() << " automatically identified for group " << u->Account()->GetDisplay(); + u->logger.Bot(NickServ).Log(_("{0} automatically identified for account {1}"), u->GetMask(), u->Account()->GetDisplay()); } if (!u->nick.equals_ci(oldnick) && old_na) @@ -655,9 +655,10 @@ class NickServCore : public Module, public NickServ::NickServService if (expire) { - Log(LOG_NORMAL, "nickserv/expire", NickServ) << "Expiring nickname " << na->GetNick() << " (group: " << na->GetAccount()->GetDisplay() << ") (e-mail: " << (na->GetAccount()->GetEmail().empty() ? "none" : na->GetAccount()->GetEmail()) << ")"; + Anope::Logger.Bot(NickServ).Category("nickserv/expire").Log(_("Expiring nickname {0} (account: {1}) (e-mail: {2})"), + na->GetNick(), na->GetAccount()->GetDisplay(), na->GetAccount()->GetEmail().empty() ? "none" : na->GetAccount()->GetEmail()); EventManager::Get()->Dispatch(&NickServ::Event::NickExpire::OnNickExpire, na); - delete na; + na->Delete(); } } } diff --git a/modules/nickserv/maxemail.cpp b/modules/nickserv/maxemail.cpp index 0660e7b92..b7924d2c2 100644 --- a/modules/nickserv/maxemail.cpp +++ b/modules/nickserv/maxemail.cpp @@ -39,7 +39,7 @@ class NSMaxEmail : public Module username = username.substr(0, sz); Anope::string cleaned = username + email.substr(host); - Log(LOG_DEBUG) << "cleaned " << email << " to " << cleaned; + logger.Debug("cleaned {0} to {1}", email, cleaned); return cleaned; } diff --git a/modules/nickserv/recover.cpp b/modules/nickserv/recover.cpp index 60a0bee2f..191e6e019 100644 --- a/modules/nickserv/recover.cpp +++ b/modules/nickserv/recover.cpp @@ -50,7 +50,7 @@ class NSRecoverRequestListener : public NickServ::IdentifyRequestListener if (!na) return; - Log(LOG_COMMAND, source, cmd) << "for " << na->GetNick(); + cmd->logger.Command(LogType::COMMAND, source, _("{source} used {command} for {0}"), na->GetNick()); /* Nick is being held by us, release it */ if (na->HasFieldS("HELD")) @@ -69,7 +69,7 @@ class NSRecoverRequestListener : public NickServ::IdentifyRequestListener if (!source.GetAccount() && na->GetAccount()->IsSecure()) { source.GetUser()->Login(u->Account()); - Log(LOG_COMMAND, source, cmd) << "and was automatically identified to " << u->Account()->GetDisplay(); + cmd->logger.Command(LogType::COMMAND, source, _("{source} used {command} and was automatically identified to {0}"), u->Account()->GetDisplay()); } if (Config->GetModule("nickserv/recover")->Get<bool>("restoreonrecover")) @@ -100,7 +100,7 @@ class NSRecoverRequestListener : public NickServ::IdentifyRequestListener if (!source.GetAccount() && na->GetAccount()->IsSecure()) { source.GetUser()->Login(na->GetAccount()); // Identify the user using the command if they arent identified - Log(LOG_COMMAND, source, cmd) << "and was automatically identified to " << na->GetNick() << " (" << na->GetAccount()->GetDisplay() << ")"; + cmd->logger.Command(LogType::COMMAND, source, _("{source} used {command} and was automatically identified to {0} ({1})"), na->GetNick(), na->GetAccount()->GetDisplay()); source.Reply(_("You have been logged in as \002{0}\002."), na->GetAccount()->GetDisplay()); } @@ -139,7 +139,7 @@ class NSRecoverRequestListener : public NickServ::IdentifyRequestListener source.Reply(_("Access denied.")); if (!pass.empty()) { - Log(LOG_COMMAND, source, cmd) << "with an invalid password for " << user; + cmd->logger.Command(LogType::COMMAND, source, _("{source} used {command} with an invalid password for {0}"), user); if (source.GetUser()) source.GetUser()->BadPassword(); } diff --git a/modules/nickserv/register.cpp b/modules/nickserv/register.cpp index b06e08075..1554c0033 100644 --- a/modules/nickserv/register.cpp +++ b/modules/nickserv/register.cpp @@ -53,7 +53,7 @@ class CommandNSConfirm : public Command na->GetAccount()->SetUnconfirmed(false); EventManager::Get()->Dispatch(&NickServ::Event::NickConfirm::OnNickConfirm, source.GetUser(), na->GetAccount()); - Log(LOG_ADMIN, source, this) << "to confirm nick " << na->GetNick() << " (" << na->GetAccount()->GetDisplay() << ")"; + logger.Command(LogType::ADMIN, source, _("{source} used {command} to confirm nickname {0} ({1})"), na->GetNick(), na->GetAccount()->GetDisplay()); source.Reply(_("\002{0}\002 has been confirmed."), na->GetNick()); /* Login the users online already */ @@ -79,7 +79,7 @@ class CommandNSConfirm : public Command NickServ::Account *nc = source.nc; nc->Shrink<Anope::string>("passcode"); - Log(LOG_COMMAND, source, this) << "to confirm their email"; + logger.Command(LogType::COMMAND, source, _("{source} used {command} to confirm their email"), source.nc->GetEmail()); source.Reply(_("Your email address of \002{0}\002 has been confirmed."), source.nc->GetEmail()); nc->SetUnconfirmed(false); @@ -257,7 +257,8 @@ class CommandNSRegister : public Command na->SetLastRealname(source.GetNick()); } - Log(LOG_COMMAND, source, this) << "to register " << na->GetNick() << " (email: " << (!na->GetAccount()->GetEmail().empty() ? na->GetAccount()->GetEmail() : "none") << ")"; + logger.Command(LogType::COMMAND, source, _("{source} used {command} to register {0} (email: {1})"), + na->GetNick(), !na->GetAccount()->GetEmail().empty() ? na->GetAccount()->GetEmail() : "none"); source.Reply(_("\002{0}\002 has been registered."), u_nick); @@ -346,13 +347,13 @@ class CommandNSResend : public Command if (!SendRegmail(source.GetUser(), na, source.service)) { - Log(this->GetOwner()) << "Unable to resend registration verification code for " << source.GetNick(); + logger.Log("Unable to resend registration verificiation code for {0}", source.GetNick()); return; } na->GetAccount()->lastmail = Anope::CurTime; source.Reply(_("Your passcode has been re-sent to \002{0}\002."), na->GetAccount()->GetEmail()); - Log(LOG_COMMAND, source, this) << "to resend registration verification code"; + logger.Command(LogType::COMMAND, source, _("{source} used {command} to resend registration verification code")); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override diff --git a/modules/nickserv/resetpass.cpp b/modules/nickserv/resetpass.cpp index 2a3a8c418..5361ed091 100644 --- a/modules/nickserv/resetpass.cpp +++ b/modules/nickserv/resetpass.cpp @@ -49,7 +49,8 @@ class CommandNSResetPass : public Command if (SendResetEmail(source.GetUser(), na, source.service)) { - Log(LOG_COMMAND, source, this) << "for " << na->GetNick() << " (group: " << na->GetAccount()->GetDisplay() << ")"; + logger.Command(LogType::COMMAND, source, _("{source} used {command} for {0} (account: {1})"), na->GetNick(), na->GetAccount()->GetDisplay()); + source.Reply(_("Password reset email for \002{0}\002 has been sent."), na->GetNick()); } } @@ -109,7 +110,7 @@ class NSResetPass : public Module reset.Unset(nc); nc->SetUnconfirmed(false); - Log(LOG_COMMAND, source, &commandnsresetpass) << "confirmed RESETPASS to forcefully identify as " << na->GetNick(); + command->logger.Command(LogType::COMMAND, source, _("{source} used {command} and confirmed password reset to forcefully identify as {0}"), na->GetNick()); if (source.GetUser()) { diff --git a/modules/nickserv/set.cpp b/modules/nickserv/set.cpp index c7d03f8d2..df6696fbf 100644 --- a/modules/nickserv/set.cpp +++ b/modules/nickserv/set.cpp @@ -155,7 +155,7 @@ class CommandNSSetPassword : public Command return; } - Log(LOG_COMMAND, source, this) << "to change their password"; + logger.Command(LogType::COMMAND, source, _("{source} used {command} to change their password")); Anope::string tmp_pass; Anope::Encrypt(param, tmp_pass); @@ -216,7 +216,7 @@ class CommandNSSASetPassword : public Command return; } - Log(LOG_ADMIN, source, this) << "to change the password of " << nc->GetDisplay(); + logger.Command(LogType::ADMIN, source, _("{source} used {command} to change the password of {0}"), nc->GetDisplay()); Anope::string tmp_pass; Anope::Encrypt(params[1], tmp_pass); @@ -263,13 +263,13 @@ class CommandNSSetAutoOp : public Command if (param.equals_ci("ON")) { - Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to enable autoop for " << na->GetAccount()->GetDisplay(); + logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, _("{source} used {command} to enable autoop for {0}"), na->GetAccount()->GetDisplay()); nc->SetAutoOp(true); source.Reply(_("Services will from now on set status modes on \002{0}\002 in channels."), nc->GetDisplay()); } else if (param.equals_ci("OFF")) { - Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to disable autoop for " << na->GetAccount()->GetDisplay(); + logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, _("{source} used {command} to disable autoop for {0}"), na->GetAccount()->GetDisplay()); nc->SetAutoOp(false); source.Reply(_("Services will no longer set status modes on \002{0}\002 in channels."), nc->GetDisplay()); } @@ -356,7 +356,9 @@ class CommandNSSetDisplay : public Command if (MOD_RESULT == EVENT_STOP) return; - Log(user_na->GetAccount() == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to change the display of " << user_na->GetAccount()->GetDisplay() << " to " << na->GetNick(); + logger.Command(user_na->GetAccount() == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, + _("{source} used {command} to change the display of {0} to {1}"), + user_na->GetAccount()->GetDisplay(), na->GetNick()); user_na->GetAccount()->SetDisplay(na); @@ -483,7 +485,7 @@ class CommandNSSetEmail : public Command if (param.empty()) { - Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to unset the email of " << nc->GetDisplay(); + logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, _("{source} used {command} to unset the email of {0}"), nc->GetDisplay()); nc->SetEmail(""); source.Reply(_("E-mail address for \002{0}\002 unset."), nc->GetDisplay()); } @@ -494,7 +496,8 @@ class CommandNSSetEmail : public Command } else { - Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to change the email of " << nc->GetDisplay() << " to " << param; + logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, _("{source} used {command} to change the email of {0} to {1}"), + nc->GetDisplay(), param); nc->SetEmail(param); source.Reply(_("E-mail address for \002{0}\002 changed to \002{1}\002."), nc->GetDisplay(), param); } @@ -565,13 +568,13 @@ class CommandNSSetKeepModes : public Command if (param.equals_ci("ON")) { - Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to enable keepmodes for " << nc->GetDisplay(); + logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, _("{source} used {command} to enable keepmodes for {0}"), nc->GetDisplay()); nc->SetKeepModes(true); source.Reply(_("Keep modes for \002{0}\002 is now \002on\002."), nc->GetDisplay()); } else if (param.equals_ci("OFF")) { - Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to disable keepmodes for " << nc->GetDisplay(); + logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, _("{source} used {command} to disable keepmodes for {2}"), nc->GetDisplay()); nc->SetKeepModes(false); source.Reply(_("Keep modes for \002{0}\002 is now \002off\002."), nc->GetDisplay()); } @@ -655,7 +658,10 @@ class CommandNSSetKill : public Command nc->SetKillProtect(true); nc->SetKillQuick(false); nc->SetKillImmed(false); - Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to set kill on for " << nc->GetDisplay(); + + logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, _("{source} used {command} to set kill to {0} for {1}"), + "ON", nc->GetDisplay()); + source.Reply(_("Protection is now \002on\002 for \002{0}\002."), nc->GetDisplay()); } else if (param.equals_ci("QUICK")) @@ -663,7 +669,10 @@ class CommandNSSetKill : public Command nc->SetKillProtect(true); nc->SetKillQuick(true); nc->SetKillImmed(false); - Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to set kill quick for " << nc->GetDisplay(); + + logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, _("{source} used {command} to set kill to {0} for {1}"), + "QUICK", nc->GetDisplay()); + source.Reply(_("Protection is now \002on\002 for \002{0}\002, with a reduced delay."), nc->GetDisplay()); } else if (param.equals_ci("IMMED")) @@ -673,7 +682,10 @@ class CommandNSSetKill : public Command nc->SetKillProtect(true); nc->SetKillQuick(false); nc->SetKillImmed(true); - Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to set kill immed for " << nc->GetDisplay(); + + logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, _("{source} used {command} to set kill to {0} for {1}"), + "IMMED", nc->GetDisplay()); + source.Reply(_("Protection is now \002on\002 for \002{0}\002, with no delay."), nc->GetDisplay()); } else @@ -684,7 +696,9 @@ class CommandNSSetKill : public Command nc->SetKillProtect(true); nc->SetKillQuick(false); nc->SetKillImmed(false); - Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to disable kill for " << nc->GetDisplay(); + + logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, _("{source} used {command} to disable kill for {0}"), nc->GetDisplay()); + source.Reply(_("Protection is now \002off\002 for \002{0}\002."), nc->GetDisplay()); } else @@ -778,7 +792,8 @@ class CommandNSSetLanguage : public Command } } - Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to change the language of " << nc->GetDisplay() << " to " << param; + logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, _("{source} used {command} to change the language of {0} to {1}"), + nc->GetDisplay(), param); nc->SetLanguage(param); @@ -877,13 +892,17 @@ class CommandNSSetMessage : public Command if (param.equals_ci("ON")) { - Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to enable " << source.command << " for " << nc->GetDisplay(); + logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, _("{source} used {command} to enable {0} for {1}"), + "MSG", nc->GetDisplay()); + nc->SetMsg(true); source.Reply(_("Services will now reply to \002{0}\002 with \002messages\002."), nc->GetDisplay()); } else if (param.equals_ci("OFF")) { - Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to disable " << source.command << " for " << nc->GetDisplay(); + logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, _("{source} used {command} to disable {0} for {1}"), + "MSG", nc->GetDisplay()); + nc->SetMsg(false); source.Reply(_("Services will now reply to \002{0}\002 with \002notices\002."), nc->GetDisplay()); } @@ -974,13 +993,15 @@ class CommandNSSetSecure : public Command if (param.equals_ci("ON")) { - Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to enable secure for " << nc->GetDisplay(); + logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, _("{source} used {command} to enable {0} for {1}"), + "SECURE", nc->GetDisplay()); nc->SetSecure(true); source.Reply(_("Secure option is now \002on\002 for \002{0}\002."), nc->GetDisplay()); } else if (param.equals_ci("OFF")) { - Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to disable secure for " << nc->GetDisplay(); + logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, _("{source} used {command} to disable {0} for {1}"), + "SECURE", nc->GetDisplay()); nc->SetSecure(false); source.Reply(_("Secure option is now \002off\002 for \002{0}\002."), nc->GetDisplay()); } @@ -1058,13 +1079,17 @@ class CommandNSSASetNoexpire : public Command if (param.equals_ci("ON")) { - Log(LOG_ADMIN, source, this) << "to enable noexpire for " << na->GetAccount()->GetDisplay(); + logger.Command(LogType::ADMIN, source, _("{source} used {command} to enable {0} for {1}"), + "NOEXPIRE", na->GetAccount()->GetDisplay()); + na->SetNoExpire(true); source.Reply(_("\002{0}\002 \002will not\002 expire."), na->GetNick()); } else if (param.equals_ci("OFF")) { - Log(LOG_ADMIN, source, this) << "to disable noexpire for " << na->GetAccount()->GetDisplay(); + logger.Command(LogType::ADMIN, source, _("{source} used {command} to disable {0} for {1}"), + "NOEXPIRE", na->GetAccount()->GetDisplay()); + na->SetNoExpire(false); source.Reply(_("\002{0}\002 \002will\002 expire."), na->GetNick()); } @@ -1174,7 +1199,7 @@ class NSSet : public Module if (params[0] == n->second) { uac->SetEmail(n->first); - Log(LOG_COMMAND, source, command) << "to confirm their email address change to " << uac->GetEmail(); + command->logger.Command(LogType::COMMAND, source, _("{source} used {command} to confirm their email address change to {0}"), uac->GetEmail()); source.Reply(_("Your email address has been changed to \002%s\002."), uac->GetEmail().c_str()); ns_set_email.Unset(uac); return EVENT_STOP; diff --git a/modules/nickserv/suspend.cpp b/modules/nickserv/suspend.cpp index 90362bcf2..c630dcd92 100644 --- a/modules/nickserv/suspend.cpp +++ b/modules/nickserv/suspend.cpp @@ -194,7 +194,8 @@ class CommandNSSuspend : public Command } } - Log(LOG_ADMIN, source, this) << "for " << nick << " (" << (!reason.empty() ? reason : "No reason") << "), expires on " << (expiry_secs ? Anope::strftime(Anope::CurTime + expiry_secs) : "never"); + logger.Command(LogType::ADMIN, source, _("{source} used {command} for {0} ({1}), expires on {2}"), + nick, !reason.empty() ? reason : "No reason", expiry_secs ? Anope::strftime(Anope::CurTime + expiry_secs) : "never"); source.Reply(_("\002{0}\002 is now suspended."), na->GetNick()); EventManager::Get()->Dispatch(&Event::NickSuspend::OnNickSuspend, na); @@ -202,8 +203,9 @@ class CommandNSSuspend : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { +#warning "show expiry" source.Reply(_("Suspends \037account\037, which prevents it from being used while keeping all the data for it." - " If an expiry is given the account will be unsuspended after that period of time, otherwise the default expiry from the configuration is used.")); // XXX + " If an expiry is given the account will be unsuspended after that period of time, otherwise the default expiry from the configuration is used.")); return true; } }; @@ -238,7 +240,8 @@ class CommandNSUnSuspend : public Command return; } - Log(LOG_ADMIN, source, this) << "for " << na->GetNick() << " which was suspended by " << (!si->GetBy().empty() ? si->GetBy() : "(none)") << " for: " << (!si->GetReason().empty() ? si->GetReason() : "No reason"); + logger.Command(LogType::ADMIN, source, _("{source} used {command} for {0}, which was suspended by {1} for: {2}"), + !si->GetBy().empty() ? si->GetBy() : "(noone)", !si->GetReason().empty() ? si->GetReason() : "no reason"); si->Delete(); @@ -329,7 +332,7 @@ class NSSuspend : public Module na->SetLastSeen(Anope::CurTime); s->Delete(); - Log(LOG_NORMAL, "nickserv/expire", Config->GetClient("NickServ")) << "Expiring suspend for " << na->GetNick(); + logger.Category("nickserv/expire").Bot("NickServ").Log(_("Expiring suspend for {0}"), na->GetNick()); } } diff --git a/modules/operserv/akill.cpp b/modules/operserv/akill.cpp index 9c4a53d23..10a87db2b 100644 --- a/modules/operserv/akill.cpp +++ b/modules/operserv/akill.cpp @@ -147,11 +147,12 @@ class CommandOSAKill : public Command ++affected; float percent = static_cast<float>(affected) / static_cast<float>(UserListByNick.size()) * 100.0; - if (percent > 95) + if (percent > 95) // XXX make this configurable.. { source.Reply(_("\002{0}\002 coverage is too wide; Please use a more specific mask."), mask); - Log(LOG_ADMIN, source, this) << "tried to akill " << percent << "% of the network (" << affected << " users)"; - delete x; + logger.Command(LogType::ADMIN, source, _("{source} used {command} and tried to akill {0}% of the network ({1} users)"), + 95, affected); + x->Delete(); return; } @@ -159,7 +160,7 @@ class CommandOSAKill : public Command MOD_RESULT = EventManager::Get()->Dispatch(&Event::AddXLine::OnAddXLine, source, x, akills); if (MOD_RESULT == EVENT_STOP) { - delete x; + x->Delete(); return; } @@ -169,7 +170,8 @@ class CommandOSAKill : public Command source.Reply(_("\002{0}\002 added to the akill list."), mask); - Log(LOG_ADMIN, source, this) << "on " << mask << " (" << x->GetReason() << "), expires in " << (expires ? Anope::Duration(expires - Anope::CurTime) : "never") << " [affects " << affected << " user(s) (" << percent << "%)]"; + logger.Command(LogType::ADMIN, source, _("{source} used {command} on {0} ({1}), expires in {2} [affects {3} user(s) ({4}%)]"), + mask, x->GetReason(), expires ? Anope::Duration(expires - Anope::CurTime) : "never", affected, percent); if (Anope::ReadOnly) source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); } @@ -202,7 +204,7 @@ class CommandOSAKill : public Command if (!x) return; - Log(LOG_ADMIN, source, this) << "to remove " << x->GetMask() << " from the list"; + logger.Command(LogType::ADMIN, source, _("{source} used {command} to remove {0} from the akill list"), x->GetMask()); ++deleted; x->Delete(); @@ -231,7 +233,8 @@ class CommandOSAKill : public Command { EventManager::Get()->Dispatch(&Event::DelXLine::OnDelXLine, source, x, akills); - Log(LOG_ADMIN, source, this) << "to remove " << x->GetMask() << " from the list"; + logger.Command(LogType::ADMIN, source, _("{source} used {command} to remove {0} from the akill list"), x->GetMask()); + source.Reply(_("\002{0}\002 deleted from the akill list."), x->GetMask()); x->Delete(); } @@ -345,7 +348,8 @@ class CommandOSAKill : public Command x->Delete(); } - Log(LOG_ADMIN, source, this) << "to CLEAR the list"; + logger.Command(LogType::ADMIN, source, _("{source} used {command} to CLEAR the akill list")); + source.Reply(_("The akill list has been cleared.")); if (Anope::ReadOnly) diff --git a/modules/operserv/chankill.cpp b/modules/operserv/chankill.cpp index 674200c84..32079f61d 100644 --- a/modules/operserv/chankill.cpp +++ b/modules/operserv/chankill.cpp @@ -109,7 +109,7 @@ class CommandOSChanKill : public Command akills->OnMatch(uc->user, x); } - Log(LOG_ADMIN, source, this) << "on " << c->name << " (" << realreason << ")"; + logger.Command(LogType::ADMIN, source, _("{source} used {command} to {0} ({1})"), c->name, realreason); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override diff --git a/modules/operserv/config.cpp b/modules/operserv/config.cpp index 33ef0acef..2b6ce015d 100644 --- a/modules/operserv/config.cpp +++ b/modules/operserv/config.cpp @@ -52,7 +52,8 @@ class CommandOSConfig : public Command block->Set(params[2], params[3]); - Log(LOG_ADMIN, source, this) << "to change the configuration value of " << params[1] << ":" << params[2] << " to " << params[3]; + logger.Command(LogType::ADMIN, source, _("{source} used {command} to change the configuration value of {0}:{1} to {2}"), + params[1], params[2], params[3]); source.Reply(_("Value of \002{0}:{1}\002 changed to \002{2}\002."), params[1], params[2], params[3]); } else if (what.equals_ci("VIEW")) @@ -60,7 +61,7 @@ class CommandOSConfig : public Command /* Blocks we should show */ const Anope::string show_blocks[] = { "serverinfo", "networkinfo", "options", "" }; - Log(LOG_ADMIN, source, this) << "VIEW"; + logger.Command(LogType::ADMIN, source, _("{source} used {command} to view the configuration")); for (unsigned i = 0; !show_blocks[i].empty(); ++i) { diff --git a/modules/operserv/defcon.cpp b/modules/operserv/defcon.cpp index e6839a3e8..3f24b2b63 100644 --- a/modules/operserv/defcon.cpp +++ b/modules/operserv/defcon.cpp @@ -108,7 +108,7 @@ struct DefconConfig static DefconConfig DConfig; -static void runDefCon(); +static void runDefCon(Module *module); static Anope::string defconReverseModes(const Anope::string &modes); static Timer *timeout; @@ -135,7 +135,8 @@ class DefConTimeout : public Timer { DConfig.defaultlevel = level; EventManager::Get()->Dispatch(&Event::DefconLevel::OnDefconLevel, level); - Log(Config->GetClient("OperServ"), "operserv/defcon") << "Defcon level timeout, returning to level " << level; + + this->GetOwner()->logger.Bot("OperServ").Category("operserv/defcon").Log(_("Defcon level timeout, returning to level {0}"), level); if (DConfig.globalondefcon && global) { @@ -148,7 +149,7 @@ class DefConTimeout : public Timer global->SendGlobal(NULL, "", DConfig.message); } - runDefCon(); + runDefCon(this->GetOwner()); } } }; @@ -223,7 +224,8 @@ class CommandOSDefcon : public Command source.Reply(_("Services are now at defcon \002{0}\002."), DConfig.defaultlevel); this->SendLevels(source); - Log(LOG_ADMIN, source, this) << "to change defcon level to " << newLevel; + + logger.Command(LogType::ADMIN, source, _("{source} used {command} to change defcon level to {0}"), newLevel); /* Global notice the user what is happening. Also any Message that the Admin would like to add. Set in config file. */ @@ -240,7 +242,7 @@ class CommandOSDefcon : public Command } /* Run any defcon functions, e.g. FORCE CHAN MODE */ - runDefCon(); + runDefCon(this->GetOwner()); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override @@ -299,7 +301,7 @@ class OSDefcon : public Module { if (cm->type == MODE_STATUS || cm->type == MODE_LIST) { - Log(this) << "DefConChanModes mode character '" << mode << "' cannot be locked"; + logger.Log("DefConChanModes mode character '{0}' cannot be locked", mode); continue; } else if (add) @@ -313,7 +315,7 @@ class OSDefcon : public Module if (!ss.GetToken(param)) { - Log(this) << "DefConChanModes mode character '" << mode << "' has no parameter while one is expected"; + logger.Log("DefConChanModes mode character '{0]' has no parameter while one is expected", mode); continue; } @@ -338,7 +340,7 @@ class OSDefcon : public Module { DConfig.DefConModesOn.erase("REDIRECT"); - Log(this) << "DefConChanModes must lock mode +l as well to lock mode +L"; + logger.Log("DefConChanModes must lock mode +l as well to lock mode +L"); } } @@ -517,7 +519,7 @@ class OSDefcon : public Module ServiceBot *OperServ = Config->GetClient("OperServ"); if (DConfig.Check(DEFCON_AKILL_NEW_CLIENTS) && akills) { - Log(OperServ, "operserv/defcon") << "DEFCON: adding akill for *@" << u->host; + logger.Bot(OperServ).Category("operserv/defcon").Log("Adding akill for *@{0}", u->host); #warning "xline allocated on stack" #if 0 XLine x("*@" + u->host, OperServ ? OperServ->nick : "defcon", Anope::CurTime + DConfig.akillexpire, DConfig.akillreason, XLineManager::GenerateUID()); @@ -580,7 +582,7 @@ class OSDefcon : public Module } }; -static void runDefCon() +static void runDefCon(Module *module) { ServiceBot *OperServ = Config->GetClient("OperServ"); if (DConfig.Check(DEFCON_FORCE_CHAN_MODES)) @@ -589,7 +591,7 @@ static void runDefCon() { if (DConfig.chanmodes[0] == '+' || DConfig.chanmodes[0] == '-') { - Log(OperServ, "operserv/defcon") << "DEFCON: setting " << DConfig.chanmodes << " on all channels"; + module->logger.Bot(OperServ).Category("operserv/defcon").Log(_("Setting {0} on all channels"), DConfig.chanmodes); DefConModesSet = true; for (channel_map::const_iterator it = ChannelList.begin(), it_end = ChannelList.end(); it != it_end; ++it) it->second->SetModes(OperServ, false, "%s", DConfig.chanmodes.c_str()); @@ -606,7 +608,7 @@ static void runDefCon() Anope::string newmodes = defconReverseModes(DConfig.chanmodes); if (!newmodes.empty()) { - Log(OperServ, "operserv/defcon") << "DEFCON: setting " << newmodes << " on all channels"; + module->logger.Bot(OperServ).Category("operserv/defcon").Log(_("SSetting {0} on all channels"), newmodes); for (channel_map::const_iterator it = ChannelList.begin(), it_end = ChannelList.end(); it != it_end; ++it) it->second->SetModes(OperServ, true, "%s", newmodes.c_str()); } diff --git a/modules/operserv/dns.cpp b/modules/operserv/dns.cpp index 1ccb54530..8efa94fa9 100644 --- a/modules/operserv/dns.cpp +++ b/modules/operserv/dns.cpp @@ -383,7 +383,7 @@ class CommandOSDNS : public Command if (Anope::ReadOnly) source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); - Log(LOG_ADMIN, source, this) << "to add zone " << zone; + logger.Command(LogType::ADMIN, source, _("{source} used {command} to add zone {0}"), zone); DNSZone *z = Serialize::New<DNSZone *>(); z->SetName(zone); @@ -404,7 +404,7 @@ class CommandOSDNS : public Command if (Anope::ReadOnly) source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); - Log(LOG_ADMIN, source, this) << "to delete zone " << z->GetName(); + logger.Command(LogType::ADMIN, source, _("{source} used {command} to delete zone {0}"), z->GetName()); for (DNSZoneMembership *mem : z->GetRefs<DNSZoneMembership *>()) mem->Delete(); @@ -459,7 +459,7 @@ class CommandOSDNS : public Command manager->Notify(zone); } - Log(LOG_ADMIN, source, this) << "to add server " << s->GetName() << " to zone " << z->GetName(); + logger.Command(LogType::ADMIN, source, _("{source} used {command} to add server {0} to zone {1}"), s->GetName(), z->GetName()); source.Reply(_("Server \002{0}\002 added to zone \002{1}\002."), s->GetName(), z->GetName()); } @@ -481,7 +481,8 @@ class CommandOSDNS : public Command if (Anope::ReadOnly) source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); - Log(LOG_ADMIN, source, this) << "to add server " << s->GetName(); + logger.Command(LogType::ADMIN, source, _("{source} used {command} to add server {2}"), s->GetName()); + source.Reply(_("Added server \002{0}\002."), s->GetName()); } else @@ -497,7 +498,7 @@ class CommandOSDNS : public Command if (Anope::ReadOnly) source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); - Log(LOG_ADMIN, source, this) << "to add server " << s->GetName() << " to zone " << zone; + logger.Command(LogType::ADMIN, source, _("{source} used {command} to add server {0} to zone {1}"), s->GetName(), z->GetName()); DNSZoneMembership *mem = Serialize::New<DNSZoneMembership *>(); mem->SetServer(s); @@ -541,7 +542,7 @@ class CommandOSDNS : public Command if (Anope::ReadOnly) source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); - Log(LOG_ADMIN, source, this) << "to remove server " << s->GetName() << " from zone " << z->GetName(); + logger.Command(LogType::ADMIN, source, _("{source} used {command} to remove server {0} to zone {1}"), s->GetName(), z->GetName()); if (manager) { @@ -569,7 +570,8 @@ class CommandOSDNS : public Command if (manager) manager->UpdateSerial(); - Log(LOG_ADMIN, source, this) << "to delete server " << s->GetName(); + logger.Command(LogType::ADMIN, source, _("{source} used {command} to delete server {0}"), s->GetName()); + source.Reply(_("Removed server \002{0}\002."), s->GetName()); s->Delete(); } @@ -606,7 +608,8 @@ class CommandOSDNS : public Command ip->SetIP(params[2]); source.Reply(_("Added IP \002{0}\002 to \002{1}\002."), params[2], s->GetName()); - Log(LOG_ADMIN, source, this) << "to add IP " << params[2] << " to " << s->GetName(); + + logger.Command(LogType::ADMIN, source, _("{source} used {command} to add IP {0} to {1}"), params[2], s->GetName()); if (s->Active() && manager) { @@ -635,7 +638,8 @@ class CommandOSDNS : public Command ip->Delete(); source.Reply(_("Removed IP \002{0}\002 from \002{1}\002."), params[2], s->GetName()); - Log(LOG_ADMIN, source, this) << "to remove IP " << params[2] << " from " << s->GetName(); + + logger.Command(LogType::ADMIN, source, _("{source} used {command} to add IP {0} to {1}"), params[2], s->GetName()); if (s->GetRefs<DNSIP *>().empty()) { @@ -725,7 +729,8 @@ class CommandOSDNS : public Command s->SetActive(true); source.Reply(_("Pooled \002{0}\002."), s->GetName()); - Log(LOG_ADMIN, source, this) << "to pool " << s->GetName(); + + logger.Command(LogType::ADMIN, source, _("{source} used {command} to pool {0}"), s->GetName()); } @@ -751,7 +756,8 @@ class CommandOSDNS : public Command s->SetPool(false); source.Reply(_("Depooled \002{0}\002."), s->GetName()); - Log(LOG_ADMIN, source, this) << "to depool " << s->GetName(); + + logger.Command(LogType::ADMIN, source, _("{source} used {command} to depool {0}"), s->GetName()); } public: @@ -882,7 +888,7 @@ class ModuleDNS : public Module if (dns && dns->GetPooled() && !dns->Active() && !dns->GetRefs<DNSIP *>().empty()) { dns->SetActive(true); - Log(this) << "Pooling server " << s->GetName(); + logger.Log(_("Pooling server {0}"), s->GetName()); } } } @@ -896,7 +902,7 @@ class ModuleDNS : public Module dns->SetActive(false); // Will be reactivated when it comes back else dns->SetPool(false); // Otherwise permanently pull this - Log(this) << "Depooling delinked server " << s->GetName(); + logger.Log(_("Depooling delinked server {0}"), s->GetName()); } } @@ -908,7 +914,7 @@ class ModuleDNS : public Module /* Check for user limit reached */ if (s && s->GetPooled() && s->Active() && s->GetLimit() && u->server->users >= s->GetLimit()) { - Log(this) << "Depooling full server " << s->GetName() << ": " << u->server->users << " users"; + logger.Log(_("Depooling full server {0}: {1} users"), s->GetName(), u->server->users); s->SetActive(false); } } @@ -925,7 +931,7 @@ class ModuleDNS : public Module /* Check for dropping under userlimit */ if (s->GetLimit() && !s->Active() && s->GetLimit() > u->server->users) { - Log(this) << "Pooling server " << s->GetName(); + logger.Log(_("Pooling server {0}"), s->GetName()); s->SetActive(true); } @@ -943,7 +949,7 @@ class ModuleDNS : public Module /* Check for very fast user drops */ if (s->Active() && diff <= this->user_drop_time) { - Log(this) << "Depooling server " << s->GetName() << ": dropped " << this->user_drop_mark << " users in " << diff << " seconds"; + logger.Log(_("Depooling server {0}: dropped {1} users in {2} seconds"), s->GetName(), this->user_drop_mark, diff); s->repool = Anope::CurTime + this->user_drop_readd_time; s->SetActive(false); } @@ -952,7 +958,7 @@ class ModuleDNS : public Module { s->SetActive(true); s->repool = 0; - Log(this) << "Pooling server " << s->GetName(); + logger.Log(_("Pooling server {0}"), s->GetName()); } } } @@ -1020,7 +1026,7 @@ class ModuleDNS : public Module if (last_warn + 60 < Anope::CurTime) { last_warn = Anope::CurTime; - Log(this) << "Warning! There are no pooled servers!"; + logger.Log("Warning! There are no pooled servers!"); } /* Something messed up, just return them all and hope one is available */ @@ -1040,7 +1046,7 @@ class ModuleDNS : public Module if (packet->answers.size() == answer_size) { - Log(this) << "Error! There are no servers with any IPs of type " << q.type; + logger.Log("Error! There are no servers with any IPs of type {0}", q.type); /* Send back an empty answer anyway */ } } diff --git a/modules/operserv/forbid.cpp b/modules/operserv/forbid.cpp index bf38fc2ac..928aa2685 100644 --- a/modules/operserv/forbid.cpp +++ b/modules/operserv/forbid.cpp @@ -158,7 +158,7 @@ class MyForbidService : public ForbidService else if (d->GetType() == FT_EMAIL) ftype = "email"; - Log(LOG_NORMAL, "expire/forbid", Config->GetClient("OperServ")) << "Expiring forbid for " << d->GetMask() << " type " << ftype; + this->GetOwner()->logger.Bot("OperServ").Category("expire/forbid").Log(_("Expiring forbid for {0} type {1}"), d->GetMask(), ftype); d->Delete(); } return Serialize::GetObjects<ForbidData *>(); @@ -270,7 +270,8 @@ class CommandOSForbid : public Command if (Anope::ReadOnly) source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); - Log(LOG_ADMIN, source, this) << "to add a forbid on " << entry << " of type " << subcommand; + logger.Command(LogType::ADMIN, source, _("{source} used {command} to add a forbid on {0} of type {1}"), entry, subcommand); + source.Reply(_("Added a forbid on \002{0}\002 of type \002{1}\002 to expire on \002{2}\002."), entry, subcommand.lower(), expiryt ? Anope::strftime(expiryt, source.GetAccount()) : "never"); /* apply forbid */ @@ -381,7 +382,8 @@ class CommandOSForbid : public Command if (Anope::ReadOnly) source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); - Log(LOG_ADMIN, source, this) << "to remove forbid on " << d->GetMask() << " of type " << subcommand; + logger.Command(LogType::ADMIN, source, _("{source} used {command} to remove forbid on {0} of type {1}"), d->GetMask(), subcommand); + source.Reply(_("\002{0}\002 deleted from the \002{1}\002 forbid list."), d->GetMask(), subcommand); d->Delete(); } diff --git a/modules/operserv/ignore.cpp b/modules/operserv/ignore.cpp index 397916ca4..afdd36837 100644 --- a/modules/operserv/ignore.cpp +++ b/modules/operserv/ignore.cpp @@ -155,7 +155,7 @@ class OSIgnoreService : public IgnoreService if (id->GetTime() && !Anope::NoExpire && id->GetTime() <= Anope::CurTime) { - Log(LOG_NORMAL, "expire/ignore", Config->GetClient("OperServ")) << "Expiring ignore entry " << id->GetMask(); + this->GetOwner()->logger.Bot("OperServ").Category("expire/ignore").Log(_("Expiring ignore for {0}"), id->GetMask()); id->Delete(); } else @@ -244,12 +244,14 @@ class CommandOSIgnore : public Command if (!t) { source.Reply(_("\002{0}\002 will now permanently be ignored."), mask); - Log(LOG_ADMIN, source, this) << "to add a permanent ignore for " << mask; + + logger.Command(LogType::ADMIN, source, _("{source} used {command} to add a permanent ignore for {0}"), mask); } else { source.Reply(_("\002{0}\002 will now be ignored for \002{1}\002."), mask, Anope::Duration(t, source.GetAccount())); - Log(LOG_ADMIN, source, this) << "to add an ignore on " << mask << " for " << Anope::Duration(t); + + logger.Command(LogType::ADMIN, source, _("{source} used {command} to add an ignore on {0} for {1}"), mask, Anope::Duration(t)); } } @@ -261,7 +263,7 @@ class CommandOSIgnore : public Command { if (id->GetTime() && !Anope::NoExpire && id->GetTime() <= Anope::CurTime) { - Log(LOG_NORMAL, "expire/ignore", Config->GetClient("OperServ")) << "Expiring ignore entry " << id->GetMask(); + this->GetOwner()->logger.Bot("OperServ").Category("expire/ignore").Log(_("Expiring ignore entry {0}"), id->GetMask()); id->Delete(); } } @@ -321,7 +323,8 @@ class CommandOSIgnore : public Command if (Anope::ReadOnly) source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); - Log(LOG_ADMIN, source, this) << "to remove an ignore on " << mask; + logger.Command(LogType::ADMIN, source, _("{source} used {command} to remove an ignore on {0}"), mask); + source.Reply(_("\002{0}\002 will no longer be ignored."), mask); ign->Delete(); } @@ -334,7 +337,8 @@ class CommandOSIgnore : public Command for (Ignore *ign : Serialize::GetObjects<Ignore *>()) ign->Delete(); - Log(LOG_ADMIN, source, this) << "to CLEAR the list"; + logger.Command(LogType::ADMIN, source, _("{source} used {command} to CLEAR the ignore list")); + source.Reply(_("Ignore list has been cleared.")); } diff --git a/modules/operserv/info.cpp b/modules/operserv/info.cpp index c6038af5a..ff88a07d1 100644 --- a/modules/operserv/info.cpp +++ b/modules/operserv/info.cpp @@ -171,7 +171,8 @@ class CommandOSInfo : public Command o->SetCreated(Anope::CurTime); source.Reply(_("Added info to \002{0}\002."), target); - Log(LOG_ADMIN, source, this) << "to add information to " << target; + + logger.Command(LogType::ADMIN, source, _("{source} used {command} to add oper information to {0}: {1}"), target, info); if (Anope::ReadOnly) source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); @@ -198,7 +199,8 @@ class CommandOSInfo : public Command o->Delete(); source.Reply(_("Deleted info from \002{0}\002."), target); - Log(LOG_ADMIN, source, this) << "to remove information from " << target; + + logger.Command(LogType::ADMIN, source, _("{source} used {command} to remove oper information from {0}: {1}"), target, info); if (Anope::ReadOnly) source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); @@ -222,7 +224,8 @@ class CommandOSInfo : public Command o->Delete(); source.Reply(_("Cleared info from \002{0}\002."), target); - Log(LOG_ADMIN, source, this) << "to clear information for " << target; + + logger.Command(LogType::ADMIN, source, _("{source} used {command} to clear oper information for {0}"), target); if (Anope::ReadOnly) source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); diff --git a/modules/operserv/jupe.cpp b/modules/operserv/jupe.cpp index 882effa4f..1d31ab1b4 100644 --- a/modules/operserv/jupe.cpp +++ b/modules/operserv/jupe.cpp @@ -42,7 +42,7 @@ class CommandOSJupe : public Command if (server == Me || server == Servers::GetUplink() || server->IsULined()) { - source.Reply(_("You can not jupe Servoces or its uplink server.")); + source.Reply(_("You can not jupe services, it's uplink, or any U:lined servers.")); return; } @@ -63,7 +63,7 @@ class CommandOSJupe : public Command Server *juped_server = new Server(Me, jserver, 1, rbuf, sid, true); IRCD->Send<messages::MessageServer>(juped_server); - Log(LOG_ADMIN, source, this) << "on " << jserver << " (" << rbuf << ")"; + logger.Command(LogType::ADMIN, source, _("{source} used {command} on {0} ({1}"), jserver, rbuf); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override diff --git a/modules/operserv/kick.cpp b/modules/operserv/kick.cpp index 37e186156..ea9820dc2 100644 --- a/modules/operserv/kick.cpp +++ b/modules/operserv/kick.cpp @@ -60,7 +60,7 @@ class CommandOSKick : public Command return; } - Log(LOG_ADMIN, source, this) << "on " << u2->nick << " in " << c->name << " (" << s << ")"; + logger.Command(LogType::ADMIN, source, _("{source} used {command} on {0} in {1} ({2})"), u2->nick, c->name, s); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override diff --git a/modules/operserv/kill.cpp b/modules/operserv/kill.cpp index e4c97bcf4..42571bc10 100644 --- a/modules/operserv/kill.cpp +++ b/modules/operserv/kill.cpp @@ -50,7 +50,9 @@ class CommandOSKill : public Command reason = "No reason specified"; if (Config->GetModule("operserv/main")->Get<bool>("addakiller")) reason = "(" + source.GetNick() + ") " + reason; - Log(LOG_ADMIN, source, this) << "on " << u2->nick << " for " << reason; + + logger.Command(LogType::ADMIN, source, _("{source} used {command} on {0} for {1}"), u2->nick, reason); + u2->Kill(*source.service, reason); } diff --git a/modules/operserv/list.cpp b/modules/operserv/list.cpp index 00b7bf746..e149c7e4b 100644 --- a/modules/operserv/list.cpp +++ b/modules/operserv/list.cpp @@ -36,9 +36,9 @@ class CommandOSChanList : public Command User *u2; if (!pattern.empty()) - Log(LOG_ADMIN, source, this) << "for " << pattern; + logger.Command(LogType::ADMIN, source, _("{source} used {command} for {0}"), pattern); else - Log(LOG_ADMIN, source, this); + logger.Command(LogType::ADMIN, source, _("{source} used {command}")); if (!opt.empty() && opt.equals_ci("SECRET")) { @@ -138,9 +138,9 @@ class CommandOSUserList : public Command std::set<Anope::string> modes; if (!pattern.empty()) - Log(LOG_ADMIN, source, this) << "for " << pattern; + logger.Command(LogType::ADMIN, source, _("{source} used {command} for {0}"), pattern); else - Log(LOG_ADMIN, source, this); + logger.Command(LogType::ADMIN, source, _("{source} used {command}")); if (!opt.empty() && opt.equals_ci("INVISIBLE")) modes.insert("INVIS"); diff --git a/modules/operserv/login.cpp b/modules/operserv/login.cpp index 270958875..f9dcdd38f 100644 --- a/modules/operserv/login.cpp +++ b/modules/operserv/login.cpp @@ -59,7 +59,8 @@ class CommandOSLogin : public Command return; } - Log(LOG_ADMIN, source, this) << "and successfully identified to " << source.service->nick; + logger.Command(LogType::ADMIN, source, _("{source} used {command} and successfully identified to {0}"), source.service->nick); + u->Extend<bool>("os_login", true); source.Reply(_("Password accepted.")); } @@ -106,7 +107,8 @@ class CommandOSLogout : public Command return; } - Log(LOG_ADMIN, source, this); + logger.Command(LogType::ADMIN, source, _("{source} used {command}")); + u->Shrink<bool>("os_login"); source.Reply(_("You have been logged out.")); } diff --git a/modules/operserv/logsearch.cpp b/modules/operserv/logsearch.cpp index d9dc7b891..702abe0e0 100644 --- a/modules/operserv/logsearch.cpp +++ b/modules/operserv/logsearch.cpp @@ -95,14 +95,16 @@ class CommandOSLogSearch : public Command for (; i < params.size(); ++i) search_string += " " + params[i]; - Log(LOG_ADMIN, source, this) << "for " << search_string; + logger.Command(LogType::ADMIN, source, _("{source} used {command} for {2}"), search_string); const Anope::string &logfile_name = Config->GetModule(this->GetOwner())->Get<Anope::string>("logname"); std::list<Anope::string> matches; for (int d = days - 1; d >= 0; --d) { Anope::string lf_name = CreateLogName(logfile_name, Anope::CurTime - (d * 86400)); - Log(LOG_DEBUG) << "Searching " << lf_name; + + this->logger.Debug("Searching {0}", lf_name); + std::fstream fd(lf_name.c_str(), std::ios_base::in); if (!fd.is_open()) continue; diff --git a/modules/operserv/main/operserv.cpp b/modules/operserv/main/operserv.cpp index fc8dbf423..93c106497 100644 --- a/modules/operserv/main/operserv.cpp +++ b/modules/operserv/main/operserv.cpp @@ -33,7 +33,8 @@ class SGLineManager : public XLineManager void OnExpire(XLine *x) override { - ::Log(Config->GetClient("OperServ"), "expire/akill") << "AKILL on \002" << x->GetMask() << "\002 has expired"; + Anope::Logger.Bot("OperServ").Category("expire/akill").Log(_("AKILL on \002{0}\002 has expired"), + x->GetMask()); } void Send(User *u, XLine *x) override @@ -85,7 +86,7 @@ class SQLineManager : public XLineManager void OnExpire(XLine *x) override { - ::Log(Config->GetClient("OperServ"), "expire/sqline") << "SQLINE on \002" << x->GetMask() << "\002 has expired"; + Anope::Logger.Bot("OperServ").Category("expire/sqline").Log(_("SQLINE on \002{0}\002 has expired"), x->GetMask()); } void Send(User *u, XLine *x) override @@ -162,7 +163,7 @@ class SNLineManager : public XLineManager void OnExpire(XLine *x) override { - ::Log(Config->GetClient("OperServ"), "expire/snline") << "SNLINE on \002" << x->GetMask() << "\002 has expired"; + Anope::Logger.Bot("OperServ").Category("expire/snline").Log(_("SNLINE on \002{0}\002 has expired"), x->GetMask()); } void Send(User *u, XLine *x) override @@ -255,8 +256,8 @@ class OperServCore : public Module { if (bi == OperServ && !u->HasMode("OPER") && Config->GetModule(this)->Get<bool>("opersonly")) { - u->SendMessage(bi, "Access denied."); - ::Log(bi, "bados") << "Denied access to " << bi->nick << " from " << u->GetMask() << " (non-oper)"; + u->SendMessage(bi, _("Access denied.")); + logger.Bot(bi).Category("bados").Log(_("Denied access to {0} from {1} (non-oper)"), bi->nick, u->GetMask()); return EVENT_STOP; } @@ -266,19 +267,19 @@ class OperServCore : public Module void OnServerQuit(Server *server) override { if (server->IsJuped()) - ::Log(server, "squit", OperServ) << "Received SQUIT for juped server " << server->GetName(); + server->logger.Bot(OperServ).Category("squit").Log(_("Received SQUIT for juped server {0}"), server->GetName()); } void OnUserModeSet(const MessageSource &setter, User *u, const Anope::string &mname) override { if (mname == "OPER") - ::Log(u, "oper", OperServ) << "is now an IRC operator."; + u->logger.Bot(OperServ).Category("oper").Log(_("{0} is now an IRC operator."), u->GetMask()); } void OnUserModeUnset(const MessageSource &setter, User *u, const Anope::string &mname) override { if (mname == "OPER") - ::Log(u, "oper", OperServ) << "is no longer an IRC operator"; + u->logger.Bot(OperServ).Category("oper").Log(_("{0} is no longer an IRC operator"), u->GetMask()); } void OnUserConnect(User *u, bool &exempt) override @@ -310,7 +311,8 @@ class OperServCore : public Module { if (!params.empty() || source.c || source.service != *OperServ) return EVENT_CONTINUE; - source.Reply(_("%s commands:"), OperServ->nick.c_str()); + + source.Reply(_("{0} commands:"), OperServ->nick); return EVENT_CONTINUE; } @@ -318,10 +320,13 @@ class OperServCore : public Module { } - void OnLog(::Log *l) override + void OnLog(Logger *l) override { - if (l->type == LOG_SERVER) +#warning "" +#if 0 + if (l->type == LogType::SERVER) l->bi = OperServ; +#endif } }; diff --git a/modules/operserv/mode.cpp b/modules/operserv/mode.cpp index a66f8897f..6e7e0e157 100644 --- a/modules/operserv/mode.cpp +++ b/modules/operserv/mode.cpp @@ -140,7 +140,7 @@ class CommandOSMode : public Command } if (!log_modes.replace_all_cs("+", "").replace_all_cs("-", "").empty()) - Log(LOG_ADMIN, source, this) << log_modes << log_params << " on " << (c ? c->name : target); + logger.Command(LogType::ADMIN, source, _("{source} used {command} {0} on {1}"), log_modes + log_params, c ? c->name : target); } } @@ -169,16 +169,17 @@ class CommandOSUMode : public Command User *u2 = User::Find(target, true); if (!u2) - source.Reply(_("\002{0}\002 isn't currently online."), target); - else { - u2->SetModes(source.service, "%s", modes.c_str()); - source.Reply(_("Changed usermodes of \002{0}\002 to \002{1}\002."), u2->nick.c_str(), modes.c_str()); + source.Reply(_("\002{0}\002 isn't currently online."), target); + return; + } - u2->SendMessage(*source.service, _("\002{0}\002 changed your usermodes to \002{1}\002."), source.GetNick(), modes); + u2->SetModes(source.service, "%s", modes.c_str()); + source.Reply(_("Changed usermodes of \002{0}\002 to \002{1}\002."), u2->nick.c_str(), modes.c_str()); - Log(LOG_ADMIN, source, this) << modes << " on " << target; - } + u2->SendMessage(*source.service, _("\002{0}\002 changed your usermodes to \002{1}\002."), source.GetNick(), modes); + + logger.Command(LogType::ADMIN, source, _("{source} used {command} on {0}"), target); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override diff --git a/modules/operserv/modinfo.cpp b/modules/operserv/modinfo.cpp index cd926d1e5..e1860583c 100644 --- a/modules/operserv/modinfo.cpp +++ b/modules/operserv/modinfo.cpp @@ -32,7 +32,7 @@ class CommandOSModInfo : public Command { const Anope::string &file = params[0]; - Log(LOG_ADMIN, source, this) << "on " << file; + logger.Command(LogType::ADMIN, source, _("{source} used {command} on {0}"), file); Module *m = ModuleManager::FindModule(file); if (m == nullptr) @@ -95,9 +95,10 @@ class CommandOSModList : public Command const Anope::string ¶m = !params.empty() ? params[0] : ""; if (!param.empty()) - Log(LOG_ADMIN, source, this) << "for " << param; + logger.Command(LogType::ADMIN, source, _("{source} used {command} for {0}"), param); else - Log(LOG_ADMIN, source, this); + logger.Command(LogType::ADMIN, source, _("{source} used {command}"), + source.GetSource(), source.GetCommand()); bool third = false, vendor = false, extra = false, database = false, encryption = false, pseudoclient = false, protocol = false; diff --git a/modules/operserv/module.cpp b/modules/operserv/module.cpp index 1e4e0bac5..669638a51 100644 --- a/modules/operserv/module.cpp +++ b/modules/operserv/module.cpp @@ -35,7 +35,7 @@ class CommandOSModLoad : public Command ModuleReturn status = ModuleManager::LoadModule(mname, source.GetUser()); if (status == MOD_ERR_OK) { - Log(LOG_ADMIN, source, this) << "to load module " << mname; + logger.Command(LogType::ADMIN, source, _("{source} used {command} to load module {0}"), mname); source.Reply(_("Module \002{0}\002 loaded."), mname); } else if (status == MOD_ERR_EXISTS) @@ -101,7 +101,7 @@ class CommandOSModReLoad : public Command status = ModuleManager::LoadModule(mname, source.GetUser()); if (status == MOD_ERR_OK) { - Log(LOG_ADMIN, source, this) << "to reload module " << mname; + logger.Command(LogType::ADMIN, source, _("{source} used {command} to reload module {0}"), mname); source.Reply(_("Module \002{0}\002 reloaded."), mname); } else @@ -151,13 +151,11 @@ class CommandOSModUnLoad : public Command return; } - Log(this->GetOwner()) << "Trying to unload module [" << mname << "]"; - ModuleReturn status = ModuleManager::UnloadModule(m, source.GetUser()); if (status == MOD_ERR_OK) { - Log(LOG_ADMIN, source, this) << "to unload module " << mname; + logger.Command(LogType::ADMIN, source, _("{source} used {command} to unload module {0}"), mname); source.Reply(_("Module \002{0}\002 unloaded."), mname); } else diff --git a/modules/operserv/news.cpp b/modules/operserv/news.cpp index e2119a2de..3a829f0c3 100644 --- a/modules/operserv/news.cpp +++ b/modules/operserv/news.cpp @@ -220,7 +220,8 @@ class NewsBase : public Command ni->SetWho(source.GetNick()); source.Reply(msgs[MSG_ADDED]); - Log(LOG_ADMIN, source, this) << "to add a news item"; + + logger.Command(LogType::ADMIN, source, _("{source} used {command} to add news item: {0}"), text); } void DoDel(CommandSource &source, const std::vector<Anope::string> ¶ms, NewsType ntype, const char **msgs) @@ -250,9 +251,13 @@ class NewsBase : public Command unsigned num = convertTo<unsigned>(text); if (num > 0 && num <= list.size()) { - list[num - 1]->Delete(); + NewsItem *item = list[num - 1]; source.Reply(msgs[MSG_DELETED], num); - Log(LOG_ADMIN, source, this) << "to delete a news item"; + + logger.Command(LogType::ADMIN, source, _("{source} used {command} to delete news item {0}"), item->GetText()); + + item->Delete(); + return; } } @@ -265,7 +270,8 @@ class NewsBase : public Command for (NewsItem *n : list) n->Delete(); source.Reply(msgs[MSG_DELETED_ALL]); - Log(LOG_ADMIN, source, this) << "to delete all news items"; + + logger.Command(LogType::ADMIN, source, _("{source} used {command} to delete all news items")); } } diff --git a/modules/operserv/noop.cpp b/modules/operserv/noop.cpp index 329a6c338..ce3ce9f9b 100644 --- a/modules/operserv/noop.cpp +++ b/modules/operserv/noop.cpp @@ -53,7 +53,8 @@ class CommandOSNOOP : public Command IRCD->Send<messages::NOOP>(s, true); s->Extend<Anope::string>("noop", source.GetNick()); - Log(LOG_ADMIN, source, this) << "SET on " << s->GetName(); + logger.Command(LogType::ADMIN, source, _("{source} used {command} on {0}"), s->GetName()); + source.Reply(_("All operators from \002{0}\002 have been removed."), s->GetName()); Anope::string reason = "NOOP command used by " + source.GetNick(); @@ -70,7 +71,9 @@ class CommandOSNOOP : public Command { s->Shrink<Anope::string>("noop"); IRCD->Send<messages::NOOP>(s, false); - Log(LOG_ADMIN, source, this) << "REVOKE on " << s->GetName(); + + logger.Command(LogType::ADMIN, source, _("{source} used {command} REVOKE on {0}"), s->GetName()); + source.Reply(_("All O:lines of \002{0}\002 have been reset."), s->GetName()); } else diff --git a/modules/operserv/oper.cpp b/modules/operserv/oper.cpp index 099cfc286..00c7e0f4d 100644 --- a/modules/operserv/oper.cpp +++ b/modules/operserv/oper.cpp @@ -97,7 +97,8 @@ class CommandOSOper : public Command if (Anope::ReadOnly) source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); - Log(LOG_ADMIN, source, this) << "ADD " << na->GetNick() << " as type " << ot->GetName(); + logger.Command(LogType::ADMIN, source, _("{source} used {command} to add {0} as an oper of type {1}"), na->GetNick(), ot->GetName()); + source.Reply("\002{0}\002 (\002{1}\002) added to the \002{2}\002 list.", na->GetNick(), na->GetAccount()->GetDisplay(), ot->GetName()); } else if (subcommand.equals_ci("DEL") && params.size() > 1) @@ -137,7 +138,8 @@ class CommandOSOper : public Command if (Anope::ReadOnly) source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); - Log(LOG_ADMIN, source, this) << "DEL " << na->GetNick(); + logger.Command(LogType::ADMIN, source, _("{source} used {command} to remove {0}"), na->GetNick()); + source.Reply(_("Oper privileges removed from \002{0}\002 (\002{1}\002)."), na->GetNick(), na->GetAccount()->GetDisplay()); } else if (subcommand.equals_ci("LIST")) diff --git a/modules/operserv/reload.cpp b/modules/operserv/reload.cpp index ecff66ac2..fa79cd0d7 100644 --- a/modules/operserv/reload.cpp +++ b/modules/operserv/reload.cpp @@ -31,7 +31,7 @@ class CommandOSReload : public Command { try { - Log(LOG_ADMIN, source, this); + logger.Command(LogType::ADMIN, source, _("{source} used {command}")); Configuration::Conf *new_config = new Configuration::Conf(); Configuration::Conf *old = Config; @@ -43,7 +43,7 @@ class CommandOSReload : public Command } catch (const ConfigException &ex) { - Log(this->GetOwner()) << "Error reloading configuration file: " << ex.GetReason(); + this->GetOwner()->logger.Log(_("Error reloading configuration file: {0}"), ex.GetReason()); source.Reply(_("Error reloading configuration file: {0}"), ex.GetReason()); } } diff --git a/modules/operserv/session.cpp b/modules/operserv/session.cpp index cdd230473..cb22f65b9 100644 --- a/modules/operserv/session.cpp +++ b/modules/operserv/session.cpp @@ -303,7 +303,7 @@ class CommandOSSession : public Command { const Anope::string &cmd = params[0]; - Log(LOG_ADMIN, source, this) << cmd << " " << params[1]; + logger.Command(LogType::ADMIN, source, _("{source} used {command} {0} {1}"), cmd, params[1]); if (!session_limit) source.Reply(_("Session limiting is disabled.")); @@ -422,7 +422,8 @@ class CommandOSException : public Command if (MOD_RESULT == EVENT_STOP) return; - Log(LOG_ADMIN, source, this) << "to set the session limit for " << mask << " to " << limit; + logger.Command(LogType::ADMIN, source, _("{source} used {command} to set the session limit for {0} to {1}"), mask, limit); + source.Reply(_("Session limit for \002{0}\002 set to \002{1}\002."), mask, limit); if (Anope::ReadOnly) source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); @@ -452,7 +453,7 @@ class CommandOSException : public Command Exception *e = exceptions[number - 1]; - Log(LOG_ADMIN, source, this) << "to remove the session limit exception for " << e->GetMask(); + logger.Command(LogType::ADMIN, source, _("{source} used {command} to remove the session limit exception for {0}"), e->GetMask()); ++deleted; DoDel(source, e); @@ -473,7 +474,8 @@ class CommandOSException : public Command for (Exception *e : Serialize::GetObjects<Exception *>()) if (mask.equals_ci(e->GetMask())) { - Log(LOG_ADMIN, source, this) << "to remove the session limit exception for " << mask; + logger.Command(LogType::ADMIN, source, _("{source} used {command} to remove the session limit exception for {0}"), e->GetMask()); + DoDel(source, e); source.Reply(_("\002{0}\002 deleted from session-limit exception list."), mask); found = true; @@ -728,7 +730,7 @@ class OSSession : public Module akills->AddXLine(x); akills->Send(NULL, x); - Log(OperServ, "akill/session") << "Added a temporary AKILL for \002" << akillmask << "\002 due to excessive connections"; + logger.Bot(OperServ).Category("akill/session").Log(_("Added a temporary AKILL for \002{0}\002 due to excessive connections"), akillmask); } else { @@ -776,7 +778,7 @@ class OSSession : public Module continue; ServiceBot *OperServ = Config->GetClient("OperServ"); - Log(OperServ, "expire/exception") << "Session exception for " << e->GetMask() << " has expired."; + logger.Bot(OperServ).Category("expire/exception").Log(_("Session exception for {0} has expired."), e->GetMask()); e->Delete(); } } diff --git a/modules/operserv/set.cpp b/modules/operserv/set.cpp index e23efb849..f8a63dca8 100644 --- a/modules/operserv/set.cpp +++ b/modules/operserv/set.cpp @@ -24,7 +24,7 @@ class CommandOSSet : public Command private: void DoList(CommandSource &source) { - Log(LOG_ADMIN, source, this) << "LIST"; + logger.Command(LogType::ADMIN, source, _("{source} used {command} LIST")); const char *str; @@ -51,13 +51,13 @@ class CommandOSSet : public Command if (setting.equals_ci("ON")) { Anope::ReadOnly = true; - Log(LOG_ADMIN, source, this) << "READONLY ON"; + logger.Command(LogType::ADMIN, source, _("{source} used {command} READONLY ON")); source.Reply(_("Services are now in \002read-only\002 mode.")); } else if (setting.equals_ci("OFF")) { Anope::ReadOnly = false; - Log(LOG_ADMIN, source, this) << "READONLY OFF"; + logger.Command(LogType::ADMIN, source, _("{source} used {command} READONLY OFF")); source.Reply(_("Services are now in \002read-write\002 mode.")); } else @@ -95,13 +95,15 @@ class CommandOSSet : public Command { source.GetUser()->super_admin = true; source.Reply(_("You are now a super admin.")); - Log(LOG_ADMIN, source, this) << "SUPERADMIN ON"; + logger.Command(LogType::ADMIN, source, _("{source} used {command} SUPERADMIN ON"), + source.GetSource(), source.GetCommand()); } else if (setting.equals_ci("OFF")) { source.GetUser()->super_admin = false; source.Reply(_("You are no longer a super admin.")); - Log(LOG_ADMIN, source, this) << "SUPERADMIN OFF"; + logger.Command(LogType::ADMIN, source, _("{source} used {command} SUPERADMIN OFF"), + source.GetSource(), source.GetCommand()); } else { @@ -122,12 +124,13 @@ class CommandOSSet : public Command if (setting.equals_ci("ON")) { Anope::Debug = 1; - Log(LOG_ADMIN, source, this) << "DEBUG ON"; + logger.Command(LogType::ADMIN, source, _("{source} used {command} DEBUG ON"), + source.GetSource(), source.GetCommand()); source.Reply(_("Services are now in \002debug\002 mode.")); } else if (setting.equals_ci("OFF") || setting == "0") { - Log(LOG_ADMIN, source, this) << "DEBUG OFF"; + logger.Command(LogType::ADMIN, source, _("{source} used {command} DEBUG OFF")); Anope::Debug = 0; source.Reply(_("Services are now in \002non-debug\002 mode.")); } @@ -136,7 +139,7 @@ class CommandOSSet : public Command try { Anope::Debug = convertTo<int>(setting); - Log(LOG_ADMIN, source, this) << "DEBUG " << Anope::Debug; + logger.Command(LogType::ADMIN, source, _("{source} used {command} DEBUG {0}"), Anope::Debug); source.Reply(_("Services are now in \002debug\002 mode (level %d)."), Anope::Debug); return; } @@ -159,13 +162,13 @@ class CommandOSSet : public Command if (setting.equals_ci("ON")) { Anope::NoExpire = true; - Log(LOG_ADMIN, source, this) << "NOEXPIRE ON"; + logger.Command(LogType::ADMIN, source, _("{source} used {command} NOEXPIRE ON"), Anope::Debug); source.Reply(_("Services are now in \002no expire\002 mode.")); } else if (setting.equals_ci("OFF")) { Anope::NoExpire = false; - Log(LOG_ADMIN, source, this) << "NOEXPIRE OFF"; + logger.Command(LogType::ADMIN, source, _("{source} used {command} NOEXPIRE OFF"), Anope::Debug); source.Reply(_("Services are now in \002expire\002 mode.")); } else diff --git a/modules/operserv/shutdown.cpp b/modules/operserv/shutdown.cpp index 030eb73f4..de987537f 100644 --- a/modules/operserv/shutdown.cpp +++ b/modules/operserv/shutdown.cpp @@ -29,7 +29,7 @@ class CommandOSRestart : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { - Log(LOG_ADMIN, source, this); + logger.Command(LogType::ADMIN, source, _("{source} used {command}")); Anope::QuitReason = source.command + " command received from " + source.GetNick(); Anope::Quitting = Anope::Restarting = true; } @@ -51,7 +51,7 @@ class CommandOSShutdown : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { - Log(LOG_ADMIN, source, this); + logger.Command(LogType::ADMIN, source, _("{source} used {command}")); Anope::QuitReason = source.command + " command received from " + source.GetNick(); Anope::Quitting = true; } diff --git a/modules/operserv/stats.cpp b/modules/operserv/stats.cpp index abee79cf6..e9df4cf83 100644 --- a/modules/operserv/stats.cpp +++ b/modules/operserv/stats.cpp @@ -246,7 +246,7 @@ class CommandOSStats : public Command { Anope::string extra = !params.empty() ? params[0] : ""; - Log(LOG_ADMIN, source, this) << extra; + logger.Command(LogType::ADMIN, source, _("{source} used {command} {0}"), extra); if (extra.equals_ci("RESET")) return this->DoStatsReset(source); @@ -318,7 +318,7 @@ class OSStats : public Module Server *sserver = u->server; if (sserver && sserver->IsSynced()) - Log(this, "maxusers") << "connected - new maximum user count: " << UserListByNick.size(); + u->logger.Category("maxusers").Log(_("{0} connected - new maximum user count: {1}"), u->GetMask(), UserListByNick.size()); } } }; diff --git a/modules/operserv/svs.cpp b/modules/operserv/svs.cpp index ccba9d8d1..40d37a5d7 100644 --- a/modules/operserv/svs.cpp +++ b/modules/operserv/svs.cpp @@ -68,7 +68,9 @@ class CommandOSSVSNick : public Command } source.Reply(_("\002{0}\002 is now being changed to \002{1}\002."), nick, newnick); - Log(LOG_ADMIN, source, this) << "to change " << nick << " to " << newnick; + + logger.Command(LogType::ADMIN, source, _("{source} used {command} to change {0} to {1}"), u2->nick, newnick); + IRCD->Send<messages::SVSNick>(u2, newnick, Anope::CurTime); } @@ -123,7 +125,9 @@ class CommandOSSVSJoin : public Command } IRCD->Send<messages::SVSJoin>(*source.service, target, params[1], ""); - Log(LOG_ADMIN, source, this) << "to force " << target->nick << " to join " << params[1]; + + logger.Command(LogType::ADMIN, source, _("{source} used {command} to force {0} to join {1}"), target->nick, params[1]); + source.Reply(_("\002{0}\002 has been joined to \002{1}\002."), target->nick, params[1]); } @@ -178,11 +182,16 @@ class CommandOSSVSPart : public Command } const Anope::string &reason = params.size() > 2 ? params[2] : ""; + IRCD->Send<messages::SVSPart>(*source.service, target, params[1], reason); + if (!reason.empty()) - Log(LOG_ADMIN, source, this) << "to force " << target->nick << " to part " << c->name << " with reason " << reason; + logger.Command(LogType::ADMIN, source, _("{source} used {command} to force {0} to part {1} with reason {2}"), + target->nick, c->name, reason); else - Log(LOG_ADMIN, source, this) << "to force " << target->nick << " to part " << c->name; + logger.Command(LogType::ADMIN, source, _("{source} used {command} to force {0} to part {1}"), + target->nick, c->name); + source.Reply(_("\002{0}\002 has been parted from \002{1}\002."), target->nick, c->name); } diff --git a/modules/operserv/sxline.cpp b/modules/operserv/sxline.cpp index 2c98805f2..47133c16e 100644 --- a/modules/operserv/sxline.cpp +++ b/modules/operserv/sxline.cpp @@ -54,7 +54,7 @@ class CommandOSSXLineBase : public Command if (!x) return; - Log(LOG_ADMIN, source, this) << "to remove " << x->GetMask() << " from the list"; + logger.Command(LogType::ADMIN, source, _("{source} used {command} to remove {0} from the list"), x->GetMask()); ++deleted; x->Delete(); @@ -81,9 +81,11 @@ class CommandOSSXLineBase : public Command EventManager::Get()->Dispatch(&Event::DelXLine::OnDelXLine, source, x, this->xlm()); + source.Reply(_("\002{0}\002 deleted from the {1} list."), x->GetMask(), source.command); + + logger.Command(LogType::ADMIN, source, _("{source} used {command} to remove {0} from the list"), x->GetMask()); + x->Delete(); - source.Reply(_("\002{0}\002 deleted from the {1} list."), mask, source.command); - Log(LOG_ADMIN, source, this) << "to remove " << mask << " from the list"; } if (Anope::ReadOnly) @@ -184,7 +186,8 @@ class CommandOSSXLineBase : public Command for (XLine *x : this->xlm()->GetXLines()) x->Delete(); - Log(LOG_ADMIN, source, this) << "to CLEAR the list"; + logger.Command(LogType::ADMIN, source, _("{source} used {command} to CLEAR the list")); + source.Reply(_("The {0} list has been cleared."), source.command); if (Anope::ReadOnly) source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); @@ -342,8 +345,11 @@ class CommandOSSNLine : public CommandOSSXLineBase if (percent > 95) { source.Reply(_("\002{0}\002 coverage is too wide; please use a more specific mask."), mask); - Log(LOG_ADMIN, source, this) << "tried to " << source.command << " " << percent << "% of the network (" << affected << " users)"; - delete x; + + logger.Command(LogType::ADMIN, source, _("{source} used {command} and tried to {0} {1}% of the network ({2} users)"), + source.command, percent, affected); + + x->Delete(); return; } @@ -351,7 +357,7 @@ class CommandOSSNLine : public CommandOSSXLineBase MOD_RESULT = EventManager::Get()->Dispatch(&Event::AddXLine::OnAddXLine, source, x, this->xlm()); if (MOD_RESULT == EVENT_STOP) { - delete x; + x->Delete(); return; } @@ -373,7 +379,11 @@ class CommandOSSNLine : public CommandOSSXLineBase } source.Reply(_("\002{0}\002 added to the {1} list."), mask, source.command); - Log(LOG_ADMIN, source, this) << "on " << mask << " (" << reason << "), expires in " << (expires ? Anope::Duration(expires - Anope::CurTime) : "never") << " [affects " << affected << " user(s) (" << percent << "%)]"; + + logger.Command(LogType::ADMIN, source, _("{source} used {command} on {0} ({1}), expires in {2} [affects {3} user(s) ({4}%)]"), + mask, reason, expires ? Anope::Duration(expires - Anope::CurTime) : "never", + affected, percent); + if (Anope::ReadOnly) source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); } @@ -560,8 +570,10 @@ class CommandOSSQLine : public CommandOSSXLineBase if (percent > 95) { source.Reply(_("\002{0}\002 coverage is too wide; please use a more specific mask."), mask); - Log(LOG_ADMIN, source, this) << "tried to SQLine " << percent << "% of the network (" << affected << " users)"; - delete x; + + logger.Command(LogType::ADMIN, source, _("{source} used {command} and tried to {0} {1}% of the network ({2} users)"), source.command, percent, affected); + + x->Delete(); return; } @@ -569,7 +581,7 @@ class CommandOSSQLine : public CommandOSSXLineBase MOD_RESULT = EventManager::Get()->Dispatch(&Event::AddXLine::OnAddXLine, source, x, this->xlm()); if (MOD_RESULT == EVENT_STOP) { - delete x; + x->Delete(); return; } @@ -617,7 +629,10 @@ class CommandOSSQLine : public CommandOSSXLineBase } source.Reply(_("\002{0}\002 added to the {1} list."), mask, source.command); - Log(LOG_ADMIN, source, this) << "on " << mask << " (" << reason << "), expires in " << (expires ? Anope::Duration(expires - Anope::CurTime) : "never") << " [affects " << affected << " user(s) (" << percent << "%)]"; + + logger.Command(LogType::ADMIN, source, _("{source} used {command} on {0} ({1}), expires in {2} [affects {3} user(s) ({4}%)]"), + mask, x->GetReason(), expires ? Anope::Duration(expires - Anope::CurTime) : "never", affected, percent); + if (Anope::ReadOnly) source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); } diff --git a/modules/protocol/bahamut.cpp b/modules/protocol/bahamut.cpp index 66e7cca61..3814cba05 100644 --- a/modules/protocol/bahamut.cpp +++ b/modules/protocol/bahamut.cpp @@ -50,7 +50,8 @@ void bahamut::senders::Akill::Send(User* u, XLine* x) x->SetID(old->GetID()); old->GetManager()->AddXLine(x); - Log(Config->GetClient("OperServ"), "akill") << "AKILL: Added an akill for " << x->GetMask() << " because " << u->GetMask() << "#" << u->realname << " matches " << old->GetMask(); + Anope::Logger.Bot("OperServ").Category("akill").Log(_("AKILL: Added an akill for {0} because {1}#{2} matches {3}"), + x->GetMask(), u->GetMask(), u->realname, old->GetMask()); } /* ZLine if we can instead */ @@ -354,7 +355,7 @@ void bahamut::Nick::Run(MessageSource &source, const std::vector<Anope::string> Server *s = Server::Find(params[6]); if (s == nullptr) { - Log(LOG_DEBUG) << "User " << params[0] << " introduced from non-existent server " << params[6] << "?"; + Anope::Logger.Debug("User {0} introduced from non-existent server {1}", params[0], params[6]); return; } @@ -436,7 +437,7 @@ void bahamut::SJoin::Run(MessageSource &source, const std::vector<Anope::string> sju.second = User::Find(buf); if (!sju.second) { - Log(LOG_DEBUG) << "SJOIN for non-existent user " << buf << " on " << params[1]; + Anope::Logger.Log("SJOIN for non-existent user {0} on {1}", buf, params[1]); continue; } diff --git a/modules/protocol/hybrid.cpp b/modules/protocol/hybrid.cpp index 2cb508f0e..e296229c3 100644 --- a/modules/protocol/hybrid.cpp +++ b/modules/protocol/hybrid.cpp @@ -58,8 +58,8 @@ void hybrid::senders::Akill::Send(User* u, XLine* x) old->GetManager()->AddXLine(xl); x = xl; - Log(Config->GetClient("OperServ"), "akill") << "AKILL: Added an akill for " << x->GetMask() << " because " << u->GetMask() << "#" - << u->realname << " matches " << old->GetMask(); + Anope::Logger.Bot("OperServ").Category("akill").Log(_("AKILL: Added an akill for {0} because {1}#{2} matches {3}"), + x->GetMask(), u->GetMask(), u->realname, old->GetMask()); } /* Calculate the time left before this would expire, capping it at 2 days */ @@ -451,7 +451,7 @@ void hybrid::SJoin::Run(MessageSource &source, const std::vector<Anope::string> sju.second = User::Find(buf); if (!sju.second) { - Log(LOG_DEBUG) << "SJOIN for non-existent user " << buf << " on " << params[1]; + Anope::Logger.Debug("SJOIN for non-existent user {0} on {1}", buf, params[1]); continue; } diff --git a/modules/protocol/inspircd20.cpp b/modules/protocol/inspircd20.cpp index 381596ee6..e53a88eaa 100644 --- a/modules/protocol/inspircd20.cpp +++ b/modules/protocol/inspircd20.cpp @@ -78,7 +78,8 @@ void inspircd20::senders::Akill::Send(User* u, XLine* x) x->SetReason(old->GetReason()); old->GetManager()->AddXLine(x); - Log(Config->GetClient("OperServ"), "akill") << "AKILL: Added an akill for " << x->GetMask() << " because " << u->GetMask() << "#" << u->realname << " matches " << old->GetMask(); + Anope::Logger.Bot("OperServ").Category("akill").Log(_("AKILL: Added an akill for {0} because {1}#{2} matches {3}"), + x->GetMask(), u->GetMask(), u->realname, old->GetMask()); } /* ZLine if we can instead */ @@ -360,7 +361,7 @@ void inspircd20::senders::Wallops::Send(const MessageSource &source, const Anope void inspircd20::Proto::SendChgIdentInternal(const Anope::string &nick, const Anope::string &vIdent) { if (!Servers::Capab.count("CHGIDENT")) - Log() << "CHGIDENT not loaded!"; + Anope::Logger.Log("CHGIDENT not loaded!"); else Uplink::Send(Me, "CHGIDENT", nick, vIdent); } @@ -368,7 +369,7 @@ void inspircd20::Proto::SendChgIdentInternal(const Anope::string &nick, const An void inspircd20::Proto::SendChgHostInternal(const Anope::string &nick, const Anope::string &vhost) { if (!Servers::Capab.count("CHGHOST")) - Log() << "CHGHOST not loaded!"; + Anope::Logger.Log("CHGHOST not loaded!"); else Uplink::Send(Me, "CHGHOST", nick, vhost); } @@ -666,14 +667,16 @@ void inspircd20::Capab::Run(MessageSource &source, const std::vector<Anope::stri ChannelMode *cm = ModeManager::FindChannelModeByChar(modechar[0]); if (cm == nullptr) { - Log(this->GetOwner()) << "Warning: Uplink has unknown channel mode " << modename << "=" << modechar; + this->GetOwner()->logger.Log("Warning: Uplink has unknown channel mode {0}={1}", + modename, modechar); continue; } char modesymbol = cm->type == MODE_STATUS ? (anope_dynamic_static_cast<ChannelModeStatus *>(cm))->symbol : 0; if (symbol != modesymbol) { - Log(this->GetOwner()) << "Warning: Channel mode " << modename << " has a misconfigured status character"; + this->GetOwner()->logger.Log("Warning: Channel mode {0} has a misconfigured status character", + modename); continue; } } @@ -697,7 +700,8 @@ void inspircd20::Capab::Run(MessageSource &source, const std::vector<Anope::stri UserMode *um = ModeManager::FindUserModeByChar(modechar[0]); if (um == nullptr) { - Log(this->GetOwner()) << "Warning: Uplink has unknown user mode " << modename << "=" << modechar; + this->GetOwner()->logger.Log("Warning: Uplink has unknown user mode {0}={1}", + modename, modechar); continue; } } @@ -716,7 +720,9 @@ void inspircd20::Capab::Run(MessageSource &source, const std::vector<Anope::stri Servers::Capab.insert("RLINE"); const Anope::string ®exengine = Config->GetBlock("options")->Get<Anope::string>("regexengine"); if (!regexengine.empty() && module.length() > 11 && regexengine != module.substr(11)) - Log() << "Warning: InspIRCd is using regex engine " << module.substr(11) << ", but we have " << regexengine << ". This may cause inconsistencies."; + this->GetOwner()->logger.Log("Warning: InspIRCd is using regex engine {0}, but we have {1}. " + "This may cause inconsistencies.", + module.substr(11), regexengine); } else if (module.equals_cs("m_topiclock.so")) Servers::Capab.insert("TOPICLOCK"); @@ -769,11 +775,11 @@ void inspircd20::Capab::Run(MessageSource &source, const std::vector<Anope::stri return; } if (!IRCD->CanSVSHold) - Log() << "SVSHOLD missing, Usage disabled until module is loaded."; + this->GetOwner()->logger.Log("SVSHOLD missing, Usage disabled until module is loaded."); if (!Servers::Capab.count("CHGHOST")) - Log() << "CHGHOST missing, Usage disabled until module is loaded."; + this->GetOwner()->logger.Log("CHGHOST missing, Usage disabled until module is loaded."); if (!Servers::Capab.count("CHGIDENT")) - Log() << "CHGIDENT missing, Usage disabled until module is loaded."; + this->GetOwner()->logger.Log("CHGIDENT missing, Usage disabled until module is loaded."); } rfc1459::Capab::Run(source, params); @@ -824,7 +830,7 @@ void inspircd20::Endburst::Run(MessageSource &source, const std::vector<Anope::s { Server *s = source.GetServer(); - Log(LOG_DEBUG) << "Processed ENDBURST for " << s->GetName(); + s->logger.Debug("Processed ENDBURST for {0}", s->GetName()); s->Sync(true); } @@ -874,7 +880,7 @@ void inspircd20::FJoin::Run(MessageSource &source, const std::vector<Anope::stri sju.second = User::Find(buf); if (!sju.second) { - Log(LOG_DEBUG) << "FJOIN for non-existent user " << buf << " on " << params[0]; + this->GetOwner()->logger.Debug("FJOIN for non-existent user {0} on {1}", buf, params[0]); continue; } @@ -1044,7 +1050,7 @@ void inspircd20::Metadata::Run(MessageSource &source, const std::vector<Anope::s if (required) { if (!plus) - Log() << "Warning: InspIRCd unloaded module " << module << ", Anope won't function correctly without it"; + this->GetOwner()->logger.Log("Warning: InspIRCd unloaded module {0}, Anope won't function correctly without it"); } else { @@ -1053,7 +1059,7 @@ void inspircd20::Metadata::Run(MessageSource &source, const std::vector<Anope::s else Servers::Capab.erase(capab); - Log() << "InspIRCd " << (plus ? "loaded" : "unloaded") << " module " << module << ", adjusted functionality"; + this->GetOwner()->logger.Log("InspIRCd {0} module {1}, adjusted functionality", plus ? "loaded" : "unloaded", module); } } diff --git a/modules/protocol/ngircd.cpp b/modules/protocol/ngircd.cpp index 7712aec8f..ce18cbbf7 100644 --- a/modules/protocol/ngircd.cpp +++ b/modules/protocol/ngircd.cpp @@ -131,7 +131,7 @@ void ngircd::Numeric005::Run(MessageSource &source, const std::vector<Anope::str unsigned newlen = convertTo<unsigned>(data), len = Config->GetBlock("networkinfo")->Get<unsigned>("nicklen"); if (len != newlen) { - Log() << "Warning: NICKLEN is " << newlen << " but networkinfo:nicklen is " << len; + Anope::Logger.Log("Warning: NICKLEN is {0} but networkinfo:nicklen is {1}", newlen, len); } } } @@ -240,10 +240,8 @@ void ngircd::Metadata::Run(MessageSource &source, const std::vector<Anope::strin { User *u = User::Find(params[0]); if (!u) - { - Log() << "received METADATA for non-existent user " << params[0]; return; - } + if (params[1].equals_cs("accountname")) { NickServ::Account *nc = NickServ::FindAccount(params[2]); @@ -339,15 +337,10 @@ void ngircd::Nick::Run(MessageSource &source, const std::vector<Anope::string> & Server *s = Server::Find(params[4]); if (s == nullptr) { - Log(LOG_DEBUG) << "User " << params[0] << " introduced from non-existent server " << params[4] << "?"; + Anope::Logger.Debug("User {0} introduced from non-existent server {1}", params[0], params[4]); return; } User::OnIntroduce(params[0], params[2], params[3], "", "", s, params[6], Anope::CurTime, params[5], "", NULL); - Log(LOG_DEBUG) << "Registered nick \"" << params[0] << "\" on server " << s->GetName() << "."; - } - else - { - Log(LOG_DEBUG) << "Received NICK with invalid number of parameters. source = " << source.GetName() << "params[0] = " << params[0] << "params.size() = " << params.size(); } } @@ -374,7 +367,7 @@ void ngircd::NJoin::Run(MessageSource &source, const std::vector<Anope::string> rfc1459::Join::SJoinUser sju; /* Get prefixes from the nick */ - for (char ch; (ch = ModeManager::GetStatusChar(buf[0]));) + for (char ch; !buf.empty() && (ch = ModeManager::GetStatusChar(buf[0]));) { buf.erase(buf.begin()); sju.first.AddMode(ch); @@ -383,7 +376,7 @@ void ngircd::NJoin::Run(MessageSource &source, const std::vector<Anope::string> sju.second = User::Find(buf); if (!sju.second) { - Log(LOG_DEBUG) << "NJOIN for non-existent user " << buf << " on " << params[0]; + Anope::Logger.Debug("NJOIN for non-existent user {0} on {1}", buf, params[0]); continue; } users.push_back(sju); 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; } diff --git a/modules/protocol/unreal.cpp b/modules/protocol/unreal.cpp index f319268b7..fd6e31875 100644 --- a/modules/protocol/unreal.cpp +++ b/modules/protocol/unreal.cpp @@ -58,7 +58,8 @@ void unreal::senders::Akill::Send(User* u, XLine* x) old->GetManager()->AddXLine(xl); x = xl; - Log(Config->GetClient("OperServ"), "akill") << "AKILL: Added an akill for " << x->GetMask() << " because " << u->GetMask() << "#" << u->realname << " matches " << old->GetMask(); + Anope::Logger.Bot("OperServ").Category("akill").Log(_("AKILL: Added an akill for {0} because {1}#{2} matches {3}"), + x->GetMask(), u->GetMask(), u->realname, old->GetMask()); } /* ZLine if we can instead */ @@ -731,7 +732,7 @@ void unreal::Nick::Run(MessageSource &source, const std::vector<Anope::string> & Server *s = Server::Find(params[5]); if (s == NULL) { - Log(LOG_DEBUG) << "User " << params[0] << " introduced from non-existent server " << params[5] << "?"; + Anope::Logger.Debug("User {0} introduced from non-existent server {1}", params[0], params[5]); return; } @@ -912,7 +913,7 @@ void unreal::SJoin::Run(MessageSource &source, const std::vector<Anope::string> rfc1459::Join::SJoinUser sju; /* Get prefixes from the nick */ - for (char ch; (ch = ModeManager::GetStatusChar(buf[0]));) + for (char ch; !buf.empty() && (ch = ModeManager::GetStatusChar(buf[0]));) { sju.first.AddMode(ch); buf.erase(buf.begin()); @@ -921,7 +922,7 @@ void unreal::SJoin::Run(MessageSource &source, const std::vector<Anope::string> sju.second = User::Find(buf); if (!sju.second) { - Log(LOG_DEBUG) << "SJOIN for non-existent user " << buf << " on " << params[1]; + Anope::Logger.Debug("SJOIN for non-existent user {0} on {1}", buf, params[1]); continue; } diff --git a/modules/redis.cpp b/modules/redis.cpp index 7a519a4e7..47d89ef42 100644 --- a/modules/redis.cpp +++ b/modules/redis.cpp @@ -68,7 +68,7 @@ class Transaction : public Interface * in this transaction */ - Log(LOG_DEBUG_2) << "redis: transaction complete with " << r.multi_bulk.size() << " results"; + this->GetOwner()->logger.Debug2("transaction complete with {0} results", r.multi_bulk.size()); for (unsigned i = 0; i < r.multi_bulk.size(); ++i) { @@ -274,7 +274,7 @@ RedisSocket::~RedisSocket() void RedisSocket::OnConnect() { - Log() << "redis: Successfully connected to " << provider->GetName() << (this == this->provider->sub ? " (sub)" : ""); + provider->GetOwner()->logger.Log(_("Successfully connected to {0}"), provider->GetName() + (this == this->provider->sub ? " (sub)" : "")); this->provider->SendCommand(NULL, "CLIENT SETNAME Anope"); this->provider->SendCommand(NULL, "SELECT " + stringify(provider->db)); @@ -282,7 +282,7 @@ void RedisSocket::OnConnect() void RedisSocket::OnError(const Anope::string &error) { - Log() << "redis: Error on " << provider->GetName() << (this == this->provider->sub ? " (sub)" : "") << ": " << error; + provider->GetOwner()->logger.Log(_("Error on {0}: {1}"), provider->GetName() + (this == this->provider->sub ? " (sub)" : ""), error); } size_t RedisSocket::ParseReply(Reply &r, const char *buffer, size_t l) @@ -301,7 +301,7 @@ size_t RedisSocket::ParseReply(Reply &r, const char *buffer, size_t l) { Anope::string reason(buffer, 1, l - 1); size_t nl = reason.find("\r\n"); - Log(LOG_DEBUG_2) << "redis: status ok: " << reason.substr(0, nl); + provider->GetOwner()->logger.Debug2("status ok: {0}", reason.substr(0, nl)); if (nl != Anope::string::npos) { r.type = Reply::OK; @@ -313,7 +313,7 @@ size_t RedisSocket::ParseReply(Reply &r, const char *buffer, size_t l) { Anope::string reason(buffer, 1, l - 1); size_t nl = reason.find("\r\n"); - Log(LOG_DEBUG) << "redis: status error: " << reason.substr(0, nl); + provider->GetOwner()->logger.Debug2("status error: {0}", reason.substr(0, nl)); if (nl != Anope::string::npos) { r.type = Reply::NOT_OK; @@ -404,7 +404,7 @@ size_t RedisSocket::ParseReply(Reply &r, const char *buffer, size_t l) size_t u = ParseReply(*reply, buffer + used, l - used); if (!u) { - Log(LOG_DEBUG) << "redis: ran out of data to parse"; + provider->GetOwner()->logger.Debug("ran out of data to parse"); delete reply; break; } @@ -414,7 +414,7 @@ size_t RedisSocket::ParseReply(Reply &r, const char *buffer, size_t l) break; } default: - Log(LOG_DEBUG) << "redis: unknown reply " << *buffer; + provider->GetOwner()->logger.Debug("unknown reply {0}", *buffer); } return used; @@ -442,13 +442,13 @@ bool RedisSocket::Read(const char *buffer, size_t l) size_t used = this->ParseReply(r, buffer, l); if (!used) { - Log(LOG_DEBUG) << "redis: used == 0 ?"; + provider->GetOwner()->logger.Debug("used == 0 ?"); r.Clear(); break; } else if (used > l) { - Log(LOG_DEBUG) << "redis: used > l ?"; + provider->GetOwner()->logger.Debug("used > l ?"); r.Clear(); break; } @@ -471,7 +471,7 @@ bool RedisSocket::Read(const char *buffer, size_t l) { if (this->interfaces.empty()) { - Log(LOG_DEBUG) << "redis: no interfaces?"; + provider->GetOwner()->logger.Debug("no interfaces?"); } else { @@ -572,7 +572,7 @@ class ModuleRedis : public Module { Interface *inter = p->sock->interfaces[i - 1]; - if (inter && inter->owner == m) + if (inter && inter->GetOwner() == m) { inter->OnError(m->name + " being unloaded"); p->sock->interfaces.erase(p->sock->interfaces.begin() + i - 1); @@ -584,7 +584,7 @@ class ModuleRedis : public Module { Interface *inter = p->sub->interfaces[i - 1]; - if (inter && inter->owner == m) + if (inter && inter->GetOwner() == m) { inter->OnError(m->name + " being unloaded"); p->sub->interfaces.erase(p->sub->interfaces.begin() + i - 1); @@ -595,7 +595,7 @@ class ModuleRedis : public Module { Interface *inter = p->ti.interfaces[i - 1]; - if (inter && inter->owner == m) + if (inter && inter->GetOwner() == m) { inter->OnError(m->name + " being unloaded"); p->ti.interfaces.erase(p->ti.interfaces.begin() + i - 1); diff --git a/modules/rewrite.cpp b/modules/rewrite.cpp index c4c5575e8..0aa0897b0 100644 --- a/modules/rewrite.cpp +++ b/modules/rewrite.cpp @@ -126,14 +126,16 @@ class RewriteCommand : public Command if (r != NULL) { Anope::string new_message = r->Process(source, full_params); - Log(LOG_DEBUG) << "m_rewrite: Rewrote '" << source.command << (!params.empty() ? " " + params[0] : "") << "' to '" << new_message << "' using '" << r->source_message << "'"; + logger.Debug("Rewrote '{0}' to '{1}' using '{2}'", source.command + (!params.empty() ? " " + params[0] : ""), new_message, r->source_message); source.service = ServiceBot::Find(r->client, true); if (!source.service) return; Command::Run(source, new_message); } else - Log() << "m_rewrite: Unable to rewrite '" << source.command << (!params.empty() ? " " + params[0] : "") << "'"; + { + logger.Log("Unable to rewrite '{0}'", source.command + (!params.empty() ? " " + params[0] : "")); + } } void OnServHelp(CommandSource &source) override diff --git a/modules/sasl.cpp b/modules/sasl.cpp index d8cd83dcf..af5bdda13 100644 --- a/modules/sasl.cpp +++ b/modules/sasl.cpp @@ -120,13 +120,13 @@ class External : public Mechanism NickServ::Account *nc = certs->FindAccountFromCert(mysess->cert); if (!nc || nc->HasFieldS("NS_SUSPENDED")) { - Log(Config->GetClient("NickServ"), "sasl") << "A user failed to identify using certificate " << mysess->cert << " using SASL EXTERNAL"; + Anope::Logger.Category("sasl").Bot("nickserv").Log(_("A user failed to identify using certificate {0} using SASL EXTERNAL"), mysess->cert); GetService()->Fail(sess); delete sess; return; } - Log(Config->GetClient("NickServ"), "sasl") << "A user identified to account " << nc->GetDisplay() << " using SASL EXTERNAL"; + Anope::Logger.Category("sasl").Bot("nickserv").Log(_("A user identified to account {0} using using SASL EXTERNAL"), nc->GetDisplay()); GetService()->Succeed(sess, nc); delete sess; } @@ -298,7 +298,7 @@ void IdentifyRequestListener::OnSuccess(NickServ::IdentifyRequest *req) Session *s = service->GetSession(uid); if (s) { - Log(Config->GetClient("NickServ"), "sasl") << "A user identified to account " << req->GetAccount() << " using SASL"; + Anope::Logger.Category("sasl").Bot("NickServ").Log(_("A user identified to account {0} using SASL"), req->GetAccount()); service->Succeed(s, na->GetAccount()); delete s; } @@ -320,7 +320,8 @@ void IdentifyRequestListener::OnFail(NickServ::IdentifyRequest *req) else if (na->GetAccount()->HasFieldS("NS_SUSPENDED")) accountstatus = "suspended "; - Log(Config->GetClient("NickServ"), "sasl") << "A user failed to identify for " << accountstatus << "account " << req->GetAccount() << " using SASL"; + Anope::Logger.Category("sasl").Bot("NickServ").Log(_("A user failed to identify for {0}account {1} using SASL"), + accountstatus, req->GetAccount()); } class ModuleSASL : public Module diff --git a/modules/sqlite.cpp b/modules/sqlite.cpp index 5fbbb855e..3cc618e4c 100644 --- a/modules/sqlite.cpp +++ b/modules/sqlite.cpp @@ -139,7 +139,7 @@ class ModuleSQLite : public Module if (i == num) { - Log(LOG_NORMAL, "sqlite") << "SQLite: Removing server connection " << cname; + logger.Log("Removing server connection {0}", cname); delete s; this->SQLiteServices.erase(cname); @@ -160,11 +160,11 @@ class ModuleSQLite : public Module SQLiteService *ss = new SQLiteService(this, connname, database); this->SQLiteServices[connname] = ss; - Log(LOG_NORMAL, "sqlite") << "SQLite: Successfully added database " << database; + logger.Log(_("Successfully added database {0}"), database); } catch (const SQL::Exception &ex) { - Log(LOG_NORMAL, "sqlite") << "SQLite: " << ex.GetReason(); + logger.Log(ex.GetReason()); } } } @@ -189,7 +189,7 @@ SQLiteService::SQLiteService(Module *o, const Anope::string &n, const Anope::str int ret = sqlite3_create_function_v2(this->sql, "anope_canonicalize", 1, SQLITE_DETERMINISTIC, NULL, Canonicalize, NULL, NULL, NULL); if (ret != SQLITE_OK) - Log(LOG_DEBUG) << "Unable to add anope_canonicalize function: " << sqlite3_errmsg(this->sql); + o->logger.Debug("Unable to add anope_canonicalize function: {0}", sqlite3_errmsg(this->sql)); } SQLiteService::~SQLiteService() @@ -216,7 +216,7 @@ Result SQLiteService::RunQuery(const Query &query) { const char *msg = sqlite3_errmsg(this->sql); - Log(LOG_DEBUG) << "sqlite: error in query " << real_query << ": " << msg; + this->GetOwner()->logger.Debug("error in query {0}: {1}", real_query, msg); return SQLiteResult(query, real_query, msg); } @@ -227,9 +227,9 @@ Result SQLiteService::RunQuery(const Query &query) sqlite3_finalize(stmt); if (!result.GetError().empty()) - Log(LOG_DEBUG) << "sqlite: error executing query " << real_query << ": " << result.GetError(); + this->GetOwner()->logger.Debug("error executing query {0}: {1}", real_query, result.GetError()); else - Log(LOG_DEBUG) << "sqlite: executed: " << real_query; + this->GetOwner()->logger.Debug("executed: {0}", real_query); return result; } diff --git a/modules/webcpanel/static_fileserver.cpp b/modules/webcpanel/static_fileserver.cpp index 858336c6c..727cf3ef2 100644 --- a/modules/webcpanel/static_fileserver.cpp +++ b/modules/webcpanel/static_fileserver.cpp @@ -34,7 +34,7 @@ bool StaticFileServer::OnRequest(HTTPProvider *server, const Anope::string &page int fd = open((template_base + "/" + this->file_name).c_str(), O_RDONLY); if (fd < 0) { - Log(LOG_NORMAL, "httpd") << "Error serving file " << page_name << " (" << (template_base + "/" + this->file_name) << "): " << strerror(errno); + Anope::Logger.Category("webcpanel").Log("Error serving file {0} ({1}/{2}): {3}", page_name, template_base, this->file_name, strerror(errno)); client->SendError(HTTP_PAGE_NOT_FOUND, "Page not found"); return true; diff --git a/modules/webcpanel/template_fileserver.cpp b/modules/webcpanel/template_fileserver.cpp index 81c4c4a5f..cad35c455 100644 --- a/modules/webcpanel/template_fileserver.cpp +++ b/modules/webcpanel/template_fileserver.cpp @@ -107,7 +107,7 @@ void TemplateFileServer::Serve(HTTPProvider *server, const Anope::string &page_n int fd = open((template_base + "/" + this->file_name).c_str(), O_RDONLY); if (fd < 0) { - Log(LOG_NORMAL, "httpd") << "Error serving file " << page_name << " (" << (template_base + "/" + this->file_name) << "): " << strerror(errno); + Anope::Logger.Category("webcpanel").Log("Error serving file {0} ({1}/{2}): {3}", page_name, template_base, this->file_name, strerror(errno)); client->SendError(HTTP_PAGE_NOT_FOUND, "Page not found"); return; @@ -161,12 +161,16 @@ void TemplateFileServer::Serve(HTTPProvider *server, const Anope::string &page_n IfStack.push(stackok && r.count(tokens[2]) > 0); } else - Log() << "Invalid IF in web template " << this->file_name; + { + Anope::Logger.Log("Invalid IF in web template {0}", this->file_name); + } } else if (content == "ELSE") { if (IfStack.empty()) - Log() << "Invalid ELSE with no stack in web template" << this->file_name; + { + Anope::Logger.Log("Invalid ELSE with no stack in web template {0}", this->file_name); + } else { bool old = IfStack.top(); @@ -178,7 +182,7 @@ void TemplateFileServer::Serve(HTTPProvider *server, const Anope::string &page_n else if (content == "END IF") { if (IfStack.empty()) - Log() << "END IF with empty stack?"; + Anope::Logger.Log("END IF with empty stack?"); else IfStack.pop(); } @@ -188,7 +192,9 @@ void TemplateFileServer::Serve(HTTPProvider *server, const Anope::string &page_n spacesepstream(content).GetTokens(tokens); if (tokens.size() != 4 || tokens[2] != "IN") - Log() << "Invalid FOR in web template " << this->file_name; + { + Anope::Logger.Log("Invalid FOR in web template {0}", this->file_name); + } else { std::vector<Anope::string> temp_variables, real_variables; @@ -196,7 +202,7 @@ void TemplateFileServer::Serve(HTTPProvider *server, const Anope::string &page_n commasepstream(tokens[3]).GetTokens(real_variables); if (temp_variables.size() != real_variables.size()) - Log() << "Invalid FOR in web template " << this->file_name << " variable mismatch"; + Anope::Logger.Log("Invalid FOR in web template {0} variable mismatch", this->file_name); else ForLoop::Stack.push_back(ForLoop(j + f, r, temp_variables, real_variables)); } @@ -204,7 +210,9 @@ void TemplateFileServer::Serve(HTTPProvider *server, const Anope::string &page_n else if (content == "END FOR") { if (ForLoop::Stack.empty()) - Log() << "END FOR with empty stack?"; + { + Anope::Logger.Log("END FOR with empty stack?"); + } else { ForLoop &fl = ForLoop::Stack.back(); @@ -229,7 +237,9 @@ void TemplateFileServer::Serve(HTTPProvider *server, const Anope::string &page_n spacesepstream(content).GetTokens(tokens); if (tokens.size() != 2) - Log() << "Invalid INCLUDE in web template " << this->file_name; + { + Anope::Logger.Log("Invalid INCLUDE in web template {0}", this->file_name); + } else { if (!finished.empty()) diff --git a/modules/xmlrpc.cpp b/modules/xmlrpc.cpp index 41bbfce0a..43d5c48f1 100644 --- a/modules/xmlrpc.cpp +++ b/modules/xmlrpc.cpp @@ -162,7 +162,7 @@ class MyXMLRPCServiceInterface : public XMLRPCServiceInterface, public HTTPPage while (GetData(content, tname, data)) { - Log(LOG_DEBUG) << "m_xmlrpc: Tag name: " << tname << ", data: " << data; + this->GetOwner()->logger.Debug("Tag name: {0}, data: {1}", tname, data); if (tname == "methodName") request.name = data; else if (tname == "name" && data == "id") |
