From 16ca76c2e7ab287e480185fbb03a0bb438351eda Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 23 Jan 2017 12:35:14 -0500 Subject: Make log system use newer format strings Also allow log messages to be translatable --- src/module.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'src/module.cpp') 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 #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; -- cgit