summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/example.conf5
-rw-r--r--include/logger.h3
-rw-r--r--modules/core/ns_identify.cpp6
-rw-r--r--src/config.cpp66
-rw-r--r--src/logger.cpp7
5 files changed, 50 insertions, 37 deletions
diff --git a/data/example.conf b/data/example.conf
index 55082ed74..6ed38c344 100644
--- a/data/example.conf
+++ b/data/example.conf
@@ -572,6 +572,11 @@ log
logage = 7
/*
+ * Enable to have the core services clients join and stay in the log channel(s) when logging
+ */
+ inhabitlogchannel = yes
+
+ /*
* What types of log messages should be logged by this block. There are nine general categories:
*
* admin - Execution of admin commands (OperServ, etc).
diff --git a/include/logger.h b/include/logger.h
index 79a582503..518e2114f 100644
--- a/include/logger.h
+++ b/include/logger.h
@@ -71,6 +71,7 @@ class CoreExport LogInfo
std::map<Anope::string, LogFile *> Logfiles;
std::list<Anope::string> Sources;
int LogAge;
+ bool Inhabit;
std::list<Anope::string> Admin;
std::list<Anope::string> Override;
std::list<Anope::string> Commands;
@@ -81,7 +82,7 @@ class CoreExport LogInfo
bool RawIO;
bool Debug;
- LogInfo(int logage, bool normal, bool rawio, bool debug);
+ LogInfo(int logage, bool inhabit, bool normal, bool rawio, bool debug);
~LogInfo();
diff --git a/modules/core/ns_identify.cpp b/modules/core/ns_identify.cpp
index c365de116..1d4938058 100644
--- a/modules/core/ns_identify.cpp
+++ b/modules/core/ns_identify.cpp
@@ -50,7 +50,7 @@ class CommandNSIdentify : public Command
res = enc_check_password(pass, na->nc->pass);
if (!res)
{
- Log(LOG_COMMAND, u, this) << "failed to identify";
+ Log(LOG_COMMAND, u, this) << "and failed to identify";
notice_lang(Config->s_NickServ, u, PASSWORD_INCORRECT);
if (bad_password(u))
return MOD_STOP;
@@ -60,7 +60,7 @@ class CommandNSIdentify : public Command
else
{
if (u->IsIdentified())
- Log(LOG_COMMAND, "nickserv/identify") << "logged out of account " << u->Account()->display;
+ Log(LOG_COMMAND, "nickserv/identify") << "to log out of account " << u->Account()->display;
na->last_realname = u->realname;
na->last_seen = time(NULL);
@@ -73,7 +73,7 @@ class CommandNSIdentify : public Command
FOREACH_MOD(I_OnNickIdentify, OnNickIdentify(u));
- Log(LOG_COMMAND, u, this) << "identified for account " << u->Account()->display;
+ Log(LOG_COMMAND, u, this) << "and identified for account " << u->Account()->display;
notice_lang(Config->s_NickServ, u, NICK_IDENTIFY_SUCCEEDED);
if (ircd->vhost)
do_on_id(u);
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)