diff options
author | Adam <Adam@anope.org> | 2010-08-28 00:14:06 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2010-08-28 00:14:06 -0400 |
commit | 10d901084f8e395646adb63c9c54affb159bc634 (patch) | |
tree | 606a13304b8221d338e634b89ef0f8cabd194e7e /src | |
parent | 334e5a4ef9067e1b0a87abd50a4aac9a711ea5ef (diff) |
Do not log RAWIO messages to services log channels, added a config option on whether or not to join bots to the log channels, and fixed two log messages in ns_identify
Diffstat (limited to 'src')
-rw-r--r-- | src/config.cpp | 66 | ||||
-rw-r--r-- | src/logger.cpp | 7 |
2 files changed, 40 insertions, 33 deletions
diff --git a/src/config.cpp b/src/config.cpp index ba5109553..3526f6636 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -835,30 +835,33 @@ bool InitLogs(ServerConfig *config, const Anope::string &) { LogInfo *l = config->LogInfos[i]; - for (std::list<Anope::string>::const_iterator sit = l->Targets.begin(), sit_end = l->Targets.end(); sit != sit_end; ++sit) + if (l->Inhabit) { - const Anope::string &target = *sit; - - if (target[0] == '#') + for (std::list<Anope::string>::const_iterator sit = l->Targets.begin(), sit_end = l->Targets.end(); sit != sit_end; ++sit) { - Channel *c = findchan(target); - if (c && c->HasFlag(CH_LOGCHAN)) + const Anope::string &target = *sit; + + if (target[0] == '#') { - for (CUserList::const_iterator cit = c->users.begin(), cit_end = c->users.end(); cit != cit_end; ++cit) + Channel *c = findchan(target); + if (c && c->HasFlag(CH_LOGCHAN)) { - UserContainer *uc = *cit; - BotInfo *bi = findbot(uc->user->nick); - - if (bi && bi->HasFlag(BI_CORE)) + for (CUserList::const_iterator cit = c->users.begin(), cit_end = c->users.end(); cit != cit_end; ++cit) { - bi->Part(c, "Reloading"); + UserContainer *uc = *cit; + BotInfo *bi = findbot(uc->user->nick); + + if (bi && bi->HasFlag(BI_CORE)) + { + bi->Part(c, "Reloading"); + } } - } - c->UnsetFlag(CH_PERSIST); - c->UnsetFlag(CH_LOGCHAN); - if (c->users.empty()) - delete c; + c->UnsetFlag(CH_PERSIST); + c->UnsetFlag(CH_LOGCHAN); + if (c->users.empty()) + delete c; + } } } } @@ -880,17 +883,18 @@ bool DoLogs(ServerConfig *config, const Anope::string &, const Anope::string *, Anope::string source = values[1].GetValue(); int logage = values[2].GetInteger(); - Anope::string admin = values[3].GetValue(); - Anope::string override = values[4].GetValue(); - Anope::string commands = values[5].GetValue(); - Anope::string servers = values[6].GetValue(); - Anope::string channels = values[7].GetValue(); - Anope::string users = values[8].GetValue(); - bool normal = values[9].GetBool(); - bool rawio = values[10].GetBool(); - bool ldebug = values[11].GetBool(); - - LogInfo *l = new LogInfo(logage, normal, rawio, ldebug); + bool inhabit = values[3].GetBool(); + Anope::string admin = values[4].GetValue(); + Anope::string override = values[5].GetValue(); + Anope::string commands = values[6].GetValue(); + Anope::string servers = values[7].GetValue(); + Anope::string channels = values[8].GetValue(); + Anope::string users = values[9].GetValue(); + bool normal = values[10].GetBool(); + bool rawio = values[11].GetBool(); + bool ldebug = values[12].GetBool(); + + LogInfo *l = new LogInfo(logage, inhabit, normal, rawio, ldebug); l->Targets = BuildStringList(targets); l->Sources = BuildStringList(source); l->Admin = BuildStringList(admin); @@ -1143,9 +1147,9 @@ void ServerConfig::Read() {DT_CHARPTR}, InitModules, DoModule, DoneModules}, {"log", - {"target", "source", "logage", "admin", "override", "commands", "servers", "channels", "users", "normal", "rawio", "debug", ""}, - {"", "", "7", "", "", "", "", "", "", "", "no", "no", ""}, - {DT_STRING, DT_STRING, DT_INTEGER, DT_STRING, DT_STRING, DT_STRING, DT_STRING, DT_STRING, DT_STRING, DT_BOOLEAN, DT_BOOLEAN, DT_BOOLEAN}, + {"target", "source", "logage", "inhabitlogchannel", "admin", "override", "commands", "servers", "channels", "users", "normal", "rawio", "debug", ""}, + {"", "", "7", "yes", "", "", "", "", "", "", "no", "no", ""}, + {DT_STRING, DT_STRING, DT_INTEGER, DT_BOOLEAN, DT_STRING, DT_STRING, DT_STRING, DT_STRING, DT_STRING, DT_STRING, DT_BOOLEAN, DT_BOOLEAN, DT_BOOLEAN}, InitLogs, DoLogs, DoneLogs}, {"opertype", {"name", "inherits", "commands", "privs", ""}, diff --git a/src/logger.cpp b/src/logger.cpp index d2621a999..92b87279d 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -17,6 +17,9 @@ void InitLogChannels(ServerConfig *config) { LogInfo *l = config->LogInfos[i]; + if (!l->Inhabit) + continue; + for (std::list<Anope::string>::const_iterator sit = l->Targets.begin(), sit_end = l->Targets.end(); sit != sit_end; ++sit) { const Anope::string &target = *sit; @@ -195,7 +198,7 @@ Log::~Log() } } -LogInfo::LogInfo(int logage, bool normal, bool rawio, bool ldebug) : LogAge(logage), Normal(normal), RawIO(rawio), Debug(ldebug) +LogInfo::LogInfo(int logage, bool inhabit, bool normal, bool rawio, bool ldebug) : LogAge(logage), Inhabit(inhabit), Normal(normal), RawIO(rawio), Debug(ldebug) { } @@ -327,7 +330,7 @@ void LogInfo::ProcessMessage(const Log *l) if (target[0] == '#') { - if (UplinkSock && !debug && Me && Me->IsSynced()) + if (UplinkSock && l->Type <= LOG_NORMAL && Me && Me->IsSynced()) { Channel *c = findchan(target); if (!c || !l->bi) |