summaryrefslogtreecommitdiff
path: root/src/module.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 /src/module.cpp
parentff030c1eb7c3764f9add2a689479e84d616cabcb (diff)
Make log system use newer format strings
Also allow log messages to be translatable
Diffstat (limited to 'src/module.cpp')
-rw-r--r--src/module.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/module.cpp b/src/module.cpp
index 73ab9ad99..7269800d5 100644
--- a/src/module.cpp
+++ b/src/module.cpp
@@ -25,7 +25,10 @@
# include <libintl.h>
#endif
-Module::Module(const Anope::string &modname, const Anope::string &, ModType modtype) : name(modname), type(modtype)
+Module::Module(const Anope::string &modname, const Anope::string &, ModType modtype)
+ : name(modname)
+ , type(modtype)
+ , logger(this)
{
this->handle = NULL;
this->permanent = false;
@@ -33,7 +36,9 @@ Module::Module(const Anope::string &modname, const Anope::string &, ModType modt
this->SetVersion(Anope::Version());
if (type & VENDOR)
+ {
this->SetAuthor("Anope");
+ }
else
{
/* Not vendor implies third */
@@ -50,7 +55,7 @@ Module::Module(const Anope::string &modname, const Anope::string &, ModType modt
ModuleManager::Modules.push_back(this);
#if GETTEXT_FOUND
- for (unsigned i = 0; i < Language::Languages.size(); ++i)
+ for (unsigned int i = 0; i < Language::Languages.size(); ++i)
{
/* Remove .UTF-8 or any other suffix */
Anope::string lang;
@@ -59,10 +64,12 @@ Module::Module(const Anope::string &modname, const Anope::string &, ModType modt
if (Anope::IsFile(Anope::LocaleDir + "/" + lang + "/LC_MESSAGES/" + modname + ".mo"))
{
if (!bindtextdomain(this->name.c_str(), Anope::LocaleDir.c_str()))
- Log() << "Error calling bindtextdomain, " << Anope::LastError();
+ {
+ Anope::Logger.Log("Error calling bindtextdomain, {0}", Anope::LastError());
+ }
else
{
- Log() << "Found language file " << lang << " for " << modname;
+ Anope::Logger.Log("Found language file {0} for {1}", lang, modname);
Language::Domains.push_back(modname);
}
break;
@@ -87,6 +94,11 @@ Module::~Module()
#endif
}
+const Anope::string &Module::GetName() const
+{
+ return this->name;
+}
+
void Module::SetPermanent(bool state)
{
this->permanent = state;