From aa4b3e256377030d291fc2d5f4db94985ce04395 Mon Sep 17 00:00:00 2001 From: DukePyrolator Date: Sun, 31 Jan 2010 06:15:29 +0000 Subject: replaced the alog() command with a new type-safe and stream-based Alog() git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2777 5417fbe8-f217-4b02-8779-1006273d7864 --- src/modules/cs_appendtopic.c | 2 +- src/modules/cs_enforce.c | 9 +++------ src/modules/hs_request.c | 11 +++++------ src/modules/ns_maxemail.c | 4 +--- src/modules/ns_noop_convert.c | 11 +++++------ 5 files changed, 15 insertions(+), 22 deletions(-) (limited to 'src/modules') diff --git a/src/modules/cs_appendtopic.c b/src/modules/cs_appendtopic.c index ee34c3b56..e94b23476 100644 --- a/src/modules/cs_appendtopic.c +++ b/src/modules/cs_appendtopic.c @@ -96,7 +96,7 @@ class CommandCSAppendTopic : public Command c->topic_time = ci->last_topic_time; if (!check_access(u, ci, CA_TOPIC)) - alog("%s: %s!%s@%s changed topic of %s as services admin.", Config.s_ChanServ, u->nick.c_str(), u->GetIdent().c_str(), u->host, c->name.c_str()); + Alog() << Config.s_ChanServ << ": " << u->GetMask() << " changed topic of " << c->name << " as services admin."; if (ircd->join2set) { if (whosends(ci) == findbot(Config.s_ChanServ)) diff --git a/src/modules/cs_enforce.c b/src/modules/cs_enforce.c index 39d936bca..9d752cd36 100644 --- a/src/modules/cs_enforce.c +++ b/src/modules/cs_enforce.c @@ -59,8 +59,7 @@ class CommandCSEnforce : public Command if (!(ci = c->ci)) return; - if (debug) - alog("debug: cs_enforce: Enforcing SECUREOPS on %s", c->name.c_str()); + Alog(LOG_DEBUG) << "[cs_enforce] Enforcing SECUREOPS on " << c->name; /* Dirty hack to allow chan_set_correct_modes to work ok. * We pretend like SECUREOPS is on so it doesn't ignore that @@ -98,8 +97,7 @@ class CommandCSEnforce : public Command if (!(ci = c->ci)) return; - if (debug) - alog("debug: cs_enforce: Enforcing RESTRICTED on %s", c->name.c_str()); + Alog(LOG_DEBUG) << "[cs_enforce] Enforcing RESTRICTED on " << c->name; old_nojoin_level = ci->levels[CA_NOJOIN]; if (ci->levels[CA_NOJOIN] < 0) @@ -131,8 +129,7 @@ class CommandCSEnforce : public Command if (!(ci = c->ci)) return; - if (debug) - alog("debug: cs_enforce: Enforcing mode +R on %s", c->name.c_str()); + Alog(LOG_DEBUG) << "[cs_enforce] Enforcing mode +R on " << c->name; for (CUserList::iterator it = c->users.begin(); it != c->users.end();) { diff --git a/src/modules/hs_request.c b/src/modules/hs_request.c index 3938c5e9b..784fcc59d 100644 --- a/src/modules/hs_request.c +++ b/src/modules/hs_request.c @@ -170,7 +170,7 @@ class CommandHSRequest : public Command me->NoticeLang(Config.s_HostServ, u, LNG_REQUESTED); req_send_memos(u, vIdent, hostmask); - alog("New vHost Requested by %s", nick); + Alog() << "New vHost Requested by " << nick; } else notice_lang(Config.s_HostServ, u, HOST_NOREG, nick); @@ -223,7 +223,7 @@ class CommandHSActivate : public Command my_memo_lang(u, na->nick, 2, LNG_ACTIVATE_MEMO); me->NoticeLang(Config.s_HostServ, u, LNG_ACTIVATED, nick); - alog("Host Request for %s activated by %s", nick, u->nick.c_str()); + Alog() << "Host Request for " << nick << " activated by " << u->nick; } else me->NoticeLang(Config.s_HostServ, u, LNG_NO_REQUEST, nick); @@ -275,7 +275,7 @@ class CommandHSReject : public Command } me->NoticeLang(Config.s_HostServ, u, LNG_REJECTED, nick); - alog("Host Request for %s rejected by %s (%s)", nick, u->nick.c_str(), reason ? reason : ""); + Alog() << "Host Request for " << nick << " rejected by " << u->nick << " (" << (reason ? reason : "") << ")"; } else me->NoticeLang(Config.s_HostServ, u, LNG_NO_REQUEST, nick); @@ -762,7 +762,7 @@ void my_memo_lang(User *u, const char *name, int z, int number, ...) delete [] buf; } else - alog("%s: INVALID language string call, language: [%d], String [%d]", me->name.c_str(), lang, number); + Alog() << me->name << ": INVALID language string call, language: [" << lang << "], String [" << number << "]"; } void req_send_memos(User *u, char *vIdent, char *vHost) @@ -819,8 +819,7 @@ void my_load_config() HSRequestMemoOper = config.ReadFlag("hs_request", "memooper", "no", 0); HSRequestMemoSetters = config.ReadFlag("hs_request", "memosetters", "no", 0); - if (debug) - alog("debug: [hs_request] Set config vars: MemoUser=%d MemoOper=%d MemoSetters=%d", HSRequestMemoUser, HSRequestMemoOper, HSRequestMemoSetters); + Alog(LOG_DEBUG) << "[hs_request] Set config vars: MemoUser=" << HSRequestMemoUser << " MemoOper=" << HSRequestMemoOper << " MemoSetters=" << HSRequestMemoSetters; } MODULE_INIT(HSRequest) diff --git a/src/modules/ns_maxemail.c b/src/modules/ns_maxemail.c index ebbd9a1e5..4817c5003 100644 --- a/src/modules/ns_maxemail.c +++ b/src/modules/ns_maxemail.c @@ -166,9 +166,7 @@ void my_load_config() { ConfigReader config; NSEmailMax = config.ReadInteger("ns_maxemail", "maxemails", "0", 0, false); - - if (debug) - alog("debug: [ns_maxemail] NSEmailMax set to %d", NSEmailMax); + Alog(LOG_DEBUG) << "[ns_maxemail] NSEmailMax set to " << NSEmailMax; } MODULE_INIT(NSMaxEmail) diff --git a/src/modules/ns_noop_convert.c b/src/modules/ns_noop_convert.c index 48b4b26ad..8cc5d69e6 100644 --- a/src/modules/ns_noop_convert.c +++ b/src/modules/ns_noop_convert.c @@ -72,8 +72,8 @@ class NSNOOPConvert : public Module mLoadData(); - alog("ns_noop_convert: Your auto-op database has been converted and this module will now"); - alog("ns_noop_convert: unload itself. You can now remove this module from your config"); + Alog() << "ns_noop_convert: Your auto-op database has been converted and this module will now"; + Alog() << "ns_noop_convert: unload itself. You can now remove this module from your config"; } ~NSNOOPConvert() @@ -102,7 +102,7 @@ int mLoadData() /* will _never_ be this big thanks to the 512 limit of a message */ char buffer[2000]; if ((in = fopen(NSAutoOPDBName, "r")) == NULL) { - alog("ns_noop: WARNING: Can not open database file! (it might not exist, this is not fatal)"); + Alog() << "ns_noop: WARNING: Can not open database file! (it might not exist, this is not fatal)"; ret = 1; } else { while (fgets(buffer, 1500, in)) { @@ -138,11 +138,10 @@ int mLoadConfig(int argc, char **argv) NSAutoOPDBName = sstrdup(tmp.c_str()); if (tmp.empty()) { - alog("ns_noop: FATAL: Can't read required configuration directives!"); + Alog() << "ns_noop: FATAL: Can't read required configuration directives!"; return MOD_STOP; } else { - alog("ns_noop: Directive NSAutoOPDBName loaded (%s)...", - NSAutoOPDBName); + Alog() << "ns_noop: Directive NSAutoOPDBName loaded (" << NSAutoOPDBName << ")..."; } return MOD_CONT; -- cgit