diff options
| author | Adam <Adam@anope.org> | 2010-08-27 20:56:28 -0400 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2010-08-27 20:56:28 -0400 |
| commit | c2ddecc2b1dbc9d055166bdf296da2e4536f74f6 (patch) | |
| tree | 9b98582630a2debab628e23d4d796885f50ada74 /modules/extra | |
| parent | 73fb94c55344b6ad788c925bf13325236402891f (diff) | |
Added a new logging system
Diffstat (limited to 'modules/extra')
| -rw-r--r-- | modules/extra/cs_appendtopic.cpp | 2 | ||||
| -rw-r--r-- | modules/extra/cs_enforce.cpp | 6 | ||||
| -rw-r--r-- | modules/extra/cs_set_misc.cpp | 2 | ||||
| -rw-r--r-- | modules/extra/db_mysql.cpp | 38 | ||||
| -rw-r--r-- | modules/extra/hs_request.cpp | 16 | ||||
| -rw-r--r-- | modules/extra/m_mysql.cpp | 10 | ||||
| -rw-r--r-- | modules/extra/m_ssl.cpp | 8 | ||||
| -rw-r--r-- | modules/extra/ns_maxemail.cpp | 2 | ||||
| -rw-r--r-- | modules/extra/ns_set_misc.cpp | 2 |
9 files changed, 39 insertions, 47 deletions
diff --git a/modules/extra/cs_appendtopic.cpp b/modules/extra/cs_appendtopic.cpp index 3da548cf2..387c55f73 100644 --- a/modules/extra/cs_appendtopic.cpp +++ b/modules/extra/cs_appendtopic.cpp @@ -95,7 +95,7 @@ class CommandCSAppendTopic : public Command c->topic_time = ci->last_topic_time; if (!check_access(u, ci, CA_TOPIC)) - Alog() << Config->s_ChanServ << ": " << u->GetMask() << " changed topic of " << c->name << " as services admin."; + Log(LOG_OVERRIDE, u, this, ci) << "changed topic to " << topic; if (ircd->join2set && whosends(ci) == ChanServ) { ChanServ->Join(c); diff --git a/modules/extra/cs_enforce.cpp b/modules/extra/cs_enforce.cpp index 1f2472e47..5541aa5ca 100644 --- a/modules/extra/cs_enforce.cpp +++ b/modules/extra/cs_enforce.cpp @@ -60,8 +60,6 @@ class CommandCSEnforce : public Command if (!(ci = c->ci)) return; - 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 * part of the code. This way we can enforce SECUREOPS even @@ -94,8 +92,6 @@ class CommandCSEnforce : public Command if (!(ci = c->ci)) return; - Alog(LOG_DEBUG) << "[cs_enforce] Enforcing RESTRICTED on " << c->name; - old_nojoin_level = ci->levels[CA_NOJOIN]; if (ci->levels[CA_NOJOIN] < 0) ci->levels[CA_NOJOIN] = 0; @@ -124,8 +120,6 @@ class CommandCSEnforce : public Command if (!(ci = c->ci)) return; - Alog(LOG_DEBUG) << "[cs_enforce] Enforcing mode +R on " << c->name; - for (CUserList::iterator it = c->users.begin(), it_end = c->users.end(); it != it_end; ) { UserContainer *uc = *it++; diff --git a/modules/extra/cs_set_misc.cpp b/modules/extra/cs_set_misc.cpp index b52eb525e..8b4395043 100644 --- a/modules/extra/cs_set_misc.cpp +++ b/modules/extra/cs_set_misc.cpp @@ -151,7 +151,7 @@ class CSSetMisc : public Module CommandInfo *info = new CommandInfo(cname, desc, showhidden); if (!this->Commands.insert(std::make_pair(cname, info)).second) { - Alog() << "cs_set_misc: Warning, unable to add duplicate entry " << cname; + Log() << "cs_set_misc: Warning, unable to add duplicate entry " << cname; delete info; continue; } diff --git a/modules/extra/db_mysql.cpp b/modules/extra/db_mysql.cpp index c09c2c336..4920e9b00 100644 --- a/modules/extra/db_mysql.cpp +++ b/modules/extra/db_mysql.cpp @@ -405,7 +405,7 @@ class DBMySQL : public Module { if (!SQL) { - Alog() << "Error, unable to find service reference for SQL, is m_mysql loaded and configured properly?"; + Log() << "Error, unable to find service reference for SQL, is m_mysql loaded and configured properly?"; return EVENT_CONTINUE; } @@ -442,7 +442,7 @@ class DBMySQL : public Module NickCore *nc = findcore(r.Get(i, "display")); if (!nc) { - Alog() << "MySQL: Got NickCore access entry for nonexistant core " << r.Get(i, "display"); + Log() << "MySQL: Got NickCore access entry for nonexistant core " << r.Get(i, "display"); continue; } @@ -455,7 +455,7 @@ class DBMySQL : public Module NickCore *nc = findcore(r.Get(i, "display")); if (!nc) { - Alog() << "MySQL: Got NickCore access entry for nonexistant core " << r.Get(i, "display"); + Log() << "MySQL: Got NickCore access entry for nonexistant core " << r.Get(i, "display"); continue; } @@ -470,7 +470,7 @@ class DBMySQL : public Module NickCore *nc = findcore(r.Get(i, "display")); if (!nc) { - Alog() << "MySQL: Got NickAlias for nick " << r.Get(i, "nick") << " with nonexistant core " << r.Get(i, "display"); + Log() << "MySQL: Got NickAlias for nick " << r.Get(i, "nick") << " with nonexistant core " << r.Get(i, "display"); continue; } @@ -502,7 +502,7 @@ class DBMySQL : public Module NickAlias *na = findnick(r.Get(i, "nick")); if (!na) { - Alog() << "MySQL: Got metadata for nonexistant nick " << r.Get(i, "nick"); + Log() << "MySQL: Got metadata for nonexistant nick " << r.Get(i, "nick"); continue; } @@ -516,9 +516,7 @@ class DBMySQL : public Module { BotInfo *bi = findbot(r.Get(i, "nick")); if (!bi) - bi = new BotInfo(r.Get(i, "nick")); - bi->SetIdent(r.Get(i, "user")); - bi->host = r.Get(i, "host"); + bi = new BotInfo(r.Get(i, "nick"), r.Get(i, "user"), r.Get(i, "host")); bi->realname = r.Get(i, "rname"); bi->created = r.Get(i, "created").is_pos_number_only() ? convertTo<time_t>(r.Get(i, "creeated")) : time(NULL); @@ -543,7 +541,7 @@ class DBMySQL : public Module BotInfo *bi = findbot(r.Get(i, "botname")); if (!bi) { - Alog() << "MySQL: BotInfo metadata for nonexistant bot " << r.Get(i, "botname"); + Log() << "MySQL: BotInfo metadata for nonexistant bot " << r.Get(i, "botname"); continue; } @@ -562,7 +560,7 @@ class DBMySQL : public Module nc = findcore(r.Get(i, "founder")); if (!nc) { - Alog() << "MySQL: Channel " << r.Get(i, "name") << " with nonexistant founder " << r.Get(i, "founder"); + Log() << "MySQL: Channel " << r.Get(i, "name") << " with nonexistant founder " << r.Get(i, "founder"); continue; } @@ -664,7 +662,7 @@ class DBMySQL : public Module ChannelInfo *ci = cs_findchan(r.Get(i, "channel")); if (!ci) { - Alog() << "MySQL: Channel ttb for nonexistant channel " << r.Get(i, "channel"); + Log() << "MySQL: Channel ttb for nonexistant channel " << r.Get(i, "channel"); continue; } @@ -677,7 +675,7 @@ class DBMySQL : public Module ChannelInfo *ci = cs_findchan(r.Get(i, "channel")); if (!ci) { - Alog() << "MySQL: Channel badwords entry for nonexistant channel " << r.Get(i, "channel"); + Log() << "MySQL: Channel badwords entry for nonexistant channel " << r.Get(i, "channel"); continue; } @@ -697,14 +695,14 @@ class DBMySQL : public Module ChannelInfo *ci = cs_findchan(r.Get(i, "channel")); if (!ci) { - Alog() << "MySQL: Channel access entry for nonexistant channel " << r.Get(i, "channel"); + Log() << "MySQL: Channel access entry for nonexistant channel " << r.Get(i, "channel"); continue; } NickCore *nc = findcore(r.Get(i, "display")); if (!nc) { - Alog() << "MySQL: Channel access entry for " << ci->name << " with nonexistant nick " << r.Get(i, "display"); + Log() << "MySQL: Channel access entry for " << ci->name << " with nonexistant nick " << r.Get(i, "display"); continue; } @@ -717,7 +715,7 @@ class DBMySQL : public Module ChannelInfo *ci = cs_findchan(r.Get(i, "channel")); if (!ci) { - Alog() << "MySQL: Channel access entry for nonexistant channel " << r.Get(i, "channel"); + Log() << "MySQL: Channel access entry for nonexistant channel " << r.Get(i, "channel"); continue; } @@ -750,7 +748,7 @@ class DBMySQL : public Module ChannelInfo *ci = cs_findchan(r.Get(i, "channel")); if (!ci) { - Alog() << "MySQL: Channel level entry for nonexistant channel " << r.Get(i, "channel"); + Log() << "MySQL: Channel level entry for nonexistant channel " << r.Get(i, "channel"); continue; } @@ -763,7 +761,7 @@ class DBMySQL : public Module ChannelInfo *ci = cs_findchan(r.Get(i, "channel")); if (!ci) { - Alog() << "MySQL: Channel metadata for nonexistant channel " << r.Get(i, "channel"); + Log() << "MySQL: Channel metadata for nonexistant channel " << r.Get(i, "channel"); continue; } @@ -1379,15 +1377,15 @@ class DBMySQL : public Module void MySQLInterface::OnResult(const SQLResult &r) { - Alog(LOG_DEBUG) << "MySQL successfully executed query: " << r.GetQuery(); + Log(LOG_DEBUG) << "MySQL successfully executed query: " << r.GetQuery(); } void MySQLInterface::OnError(const SQLResult &r) { if (!r.GetQuery().empty()) - Alog(LOG_DEBUG) << "Error executing query " << r.GetQuery() << ": " << r.GetError(); + Log(LOG_DEBUG) << "Error executing query " << r.GetQuery() << ": " << r.GetError(); else - Alog(LOG_DEBUG) << "Error executing query: " << r.GetError(); + Log(LOG_DEBUG) << "Error executing query: " << r.GetError(); } diff --git a/modules/extra/hs_request.cpp b/modules/extra/hs_request.cpp index cb23b0e11..9b1218113 100644 --- a/modules/extra/hs_request.cpp +++ b/modules/extra/hs_request.cpp @@ -139,7 +139,7 @@ class CommandHSRequest : public Command me->NoticeLang(Config->s_HostServ, u, LNG_REQUESTED); req_send_memos(u, vIdent, hostmask); - Alog() << "New vHost Requested by " << nick; + Log(LOG_COMMAND, u, this, NULL) << "to request new vhost " << (!vIdent.empty() ? vIdent + "@" : "") << hostmask; } else notice_lang(Config->s_HostServ, u, HOST_NOREG, nick.c_str()); @@ -185,14 +185,14 @@ class CommandHSActivate : public Command if (it != Requests.end()) { na->hostinfo.SetVhost(it->second->ident, it->second->host, u->nick, it->second->time); - delete it->second; - Requests.erase(it); if (HSRequestMemoUser) my_memo_lang(u, na->nick, 2, LNG_ACTIVATE_MEMO); - me->NoticeLang(Config->s_HostServ, u, LNG_ACTIVATED, nick.c_str()); - Alog() << "Host Request for " << nick << " activated by " << u->nick; + me->NoticeLang(Config->s_HostServ, u, LNG_ACTIVATED, na->nick.c_str()); + Log(LOG_COMMAND, u, this, NULL) << "for " << na->nick << " for vhost " << (!it->second->ident.empty() ? it->second->ident + "@" : "") << it->second->host; + delete it->second; + Requests.erase(it); } else me->NoticeLang(Config->s_HostServ, u, LNG_NO_REQUEST, nick.c_str()); @@ -252,7 +252,7 @@ class CommandHSReject : public Command } me->NoticeLang(Config->s_HostServ, u, LNG_REJECTED, nick.c_str()); - Alog() << "Host Request for " << nick << " rejected by " << u->nick << " (" << (!reason.empty() ? reason : "") << ")"; + Log(LOG_COMMAND, u, this, NULL) << "to reject vhost for " << nick << " (" << (!reason.empty() ? reason : "") << ")"; } else me->NoticeLang(Config->s_HostServ, u, LNG_NO_REQUEST, nick.c_str()); @@ -737,7 +737,7 @@ void my_memo_lang(User *u, const Anope::string &name, int z, int number, ...) free(buf); // XXX } else - Alog() << me->name << ": INVALID language string call, language: [" << lang << "], String [" << number << "]"; + Log() << me->name << ": INVALID language string call, language: [" << lang << "], String [" << number << "]"; } void req_send_memos(User *u, const Anope::string &vIdent, const Anope::string &vHost) @@ -794,7 +794,7 @@ void my_load_config() HSRequestMemoOper = config.ReadFlag("hs_request", "memooper", "no", 0); HSRequestMemoSetters = config.ReadFlag("hs_request", "memosetters", "no", 0); - Alog(LOG_DEBUG) << "[hs_request] Set config vars: MemoUser=" << HSRequestMemoUser << " MemoOper=" << HSRequestMemoOper << " MemoSetters=" << HSRequestMemoSetters; + Log(LOG_DEBUG) << "[hs_request] Set config vars: MemoUser=" << HSRequestMemoUser << " MemoOper=" << HSRequestMemoOper << " MemoSetters=" << HSRequestMemoSetters; } MODULE_INIT(HSRequest) diff --git a/modules/extra/m_mysql.cpp b/modules/extra/m_mysql.cpp index 289273493..f641aa655 100644 --- a/modules/extra/m_mysql.cpp +++ b/modules/extra/m_mysql.cpp @@ -58,7 +58,7 @@ class MySQLResult : public SQLResult if (!num_fields) return; - Alog(LOG_DEBUG) << "SQL query returned " << num_fields << " fields"; + Log(LOG_DEBUG) << "SQL query returned " << num_fields << " fields"; for (MYSQL_ROW row; (row = mysql_fetch_row(res));) { @@ -70,7 +70,7 @@ class MySQLResult : public SQLResult for (unsigned field_count = 0; field_count < num_fields; ++field_count) { - Alog(LOG_DEBUG) << "Field count " << field_count << " name is: " << (fields[field_count].name ? fields[field_count].name : "") << ", data is: " << (row[field_count] ? row[field_count] : ""); + Log(LOG_DEBUG) << "Field count " << field_count << " name is: " << (fields[field_count].name ? fields[field_count].name : "") << ", data is: " << (row[field_count] ? row[field_count] : ""); Anope::string column = (fields[field_count].name ? fields[field_count].name : ""); Anope::string data = (row[field_count] ? row[field_count] : ""); @@ -211,7 +211,7 @@ class ModuleSQL : public Module if (i == num) { - Alog() << "MySQL: Removing server connection " << cname; + Log(LOG_NORMAL, "mysql") << "MySQL: Removing server connection " << cname; delete s; this->MySQLServices.erase(cname); @@ -235,11 +235,11 @@ class ModuleSQL : public Module MySQLService *ss = new MySQLService(this, connname, database, server, user, password, port); this->MySQLServices.insert(std::make_pair(connname, ss)); - Alog() << "MySQL: Sucessfully connected to server " << connname << " (" << server << ")"; + Log(LOG_NORMAL, "mysql") << "MySQL: Sucessfully connected to server " << connname << " (" << server << ")"; } catch (const SQLException &ex) { - Alog() << "MySQL: " << ex.GetReason(); + Log(LOG_NORMAL, "mysql") << "MySQL: " << ex.GetReason(); } } } diff --git a/modules/extra/m_ssl.cpp b/modules/extra/m_ssl.cpp index 397facd7d..5e081c193 100644 --- a/modules/extra/m_ssl.cpp +++ b/modules/extra/m_ssl.cpp @@ -84,7 +84,7 @@ class SSLModule : public Module } } else - Alog() << "m_ssl: No certificate file found"; + Log() << "m_ssl: No certificate file found"; if (IsFile(KEYFILE)) { @@ -102,7 +102,7 @@ class SSLModule : public Module throw ModuleException("Error loading private key - file not found"); } else - Alog() << "m_ssl: No private key found"; + Log() << "m_ssl: No private key found"; } this->SetAuthor("Anope"); @@ -129,11 +129,11 @@ class SSLModule : public Module try { new SSLSocket(u->host, u->port, Config->LocalHost, u->ipv6); - Alog() << "Connected to Server " << Number << " (" << u->host << ":" << u->port << ")"; + Log() << "Connected to Server " << Number << " (" << u->host << ":" << u->port << ")"; } catch (const SocketException &ex) { - Alog() << "Unable to connect with SSL to server" << Number << " (" << u->host << ":" << u->port << "), " << ex.GetReason(); + Log() << "Unable to connect with SSL to server" << Number << " (" << u->host << ":" << u->port << "), " << ex.GetReason(); } return EVENT_ALLOW; diff --git a/modules/extra/ns_maxemail.cpp b/modules/extra/ns_maxemail.cpp index a82798916..26ee9a96d 100644 --- a/modules/extra/ns_maxemail.cpp +++ b/modules/extra/ns_maxemail.cpp @@ -163,7 +163,7 @@ void my_load_config() { ConfigReader config; NSEmailMax = config.ReadInteger("ns_maxemail", "maxemails", "0", 0, false); - Alog(LOG_DEBUG) << "[ns_maxemail] NSEmailMax set to " << NSEmailMax; + Log(LOG_DEBUG) << "[ns_maxemail] NSEmailMax set to " << NSEmailMax; } MODULE_INIT(NSMaxEmail) diff --git a/modules/extra/ns_set_misc.cpp b/modules/extra/ns_set_misc.cpp index 2d31c6b63..2d267f2c4 100644 --- a/modules/extra/ns_set_misc.cpp +++ b/modules/extra/ns_set_misc.cpp @@ -168,7 +168,7 @@ class NSSetMisc : public Module CommandInfo *info = new CommandInfo(cname, desc, showhidden); if (!this->Commands.insert(std::make_pair(cname, info)).second) { - Alog() << "ns_set_misc: Warning, unable to add duplicate entry " << cname; + Log() << "ns_set_misc: Warning, unable to add duplicate entry " << cname; delete info; continue; } |
