summaryrefslogtreecommitdiff
path: root/modules/chanserv/log.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2017-01-23 12:35:14 -0500
committerAdam <Adam@anope.org>2017-01-23 12:35:14 -0500
commit16ca76c2e7ab287e480185fbb03a0bb438351eda (patch)
treedfb25534afa2352b65b2ee707086cb5eecc96fbb /modules/chanserv/log.cpp
parentff030c1eb7c3764f9add2a689479e84d616cabcb (diff)
Make log system use newer format strings
Also allow log messages to be translatable
Diffstat (limited to 'modules/chanserv/log.cpp')
-rw-r--r--modules/chanserv/log.cpp32
1 files changed, 23 insertions, 9 deletions
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
}
};