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/operserv | |
| parent | ff030c1eb7c3764f9add2a689479e84d616cabcb (diff) | |
Make log system use newer format strings
Also allow log messages to be translatable
Diffstat (limited to 'modules/operserv')
28 files changed, 212 insertions, 139 deletions
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- |
