summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraquanight <aquanight@e03df62e-2008-0410-955e-edbf42e46eb7>2008-02-10 14:20:58 +0000
committeraquanight <aquanight@e03df62e-2008-0410-955e-edbf42e46eb7>2008-02-10 14:20:58 +0000
commitf63580a4eaa8d079200065dffa4d6a33b5577427 (patch)
treeec0d1a30442d29f5d9cc568817b0f7266bf4e514
parentb1312399e42cb4b34e86f6c7075abca64665cdd3 (diff)
Per-logstream loglevels.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8871 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--include/filelogger.h2
-rw-r--r--include/logger.h3
-rw-r--r--src/filelogger.cpp2
-rw-r--r--src/helperfuncs.cpp2
-rw-r--r--src/modules/m_chanlog.cpp16
5 files changed, 14 insertions, 11 deletions
diff --git a/include/filelogger.h b/include/filelogger.h
index 333a0236e..a2d63a0d9 100644
--- a/include/filelogger.h
+++ b/include/filelogger.h
@@ -93,7 +93,7 @@ class CoreExport FileLogStream : public LogStream
private:
FileLogger *f;
public:
- FileLogStream(InspIRCd *Instance, FILE *f) : LogStream(Instance)
+ FileLogStream(InspIRCd *Instance, int loglevel, FILE *f) : LogStream(Instance, loglevel)
{
this->f = new FileLogger(Instance, f);
}
diff --git a/include/logger.h b/include/logger.h
index 492f6c20a..8f030b53b 100644
--- a/include/logger.h
+++ b/include/logger.h
@@ -18,8 +18,9 @@ class CoreExport LogStream : public classbase
{
protected:
InspIRCd *ServerInstance;
+ int loglvl;
public:
- LogStream(InspIRCd *Instance)
+ LogStream(InspIRCd *Instance, int loglevel) : loglvl(loglevel)
{
this->ServerInstance = Instance;
}
diff --git a/src/filelogger.cpp b/src/filelogger.cpp
index d63d58915..5c2757520 100644
--- a/src/filelogger.cpp
+++ b/src/filelogger.cpp
@@ -112,7 +112,7 @@ void FileLogStream::OnLog(int loglevel, const std::string &type, const std::stri
return;
/* If we were given -debug we output all messages, regardless of configured loglevel */
- if ((loglevel < ServerInstance->Config->LogLevel) && !ServerInstance->Config->forcedebug)
+ if ((loglevel < this->loglvl) && !ServerInstance->Config->forcedebug)
return;
if (ServerInstance->Time() != LAST)
diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp
index 6118c9f8f..8ae88e752 100644
--- a/src/helperfuncs.cpp
+++ b/src/helperfuncs.cpp
@@ -324,7 +324,7 @@ bool InspIRCd::OpenLog(char**, int)
return false;
}
- FileLogStream *f = new FileLogStream(this, Config->log_file);
+ FileLogStream *f = new FileLogStream(this, Config->LogLevel, Config->log_file);
this->Logs->AddLogType("*", f);
return true;
}
diff --git a/src/modules/m_chanlog.cpp b/src/modules/m_chanlog.cpp
index a0d3da4dc..f1553ccea 100644
--- a/src/modules/m_chanlog.cpp
+++ b/src/modules/m_chanlog.cpp
@@ -17,16 +17,18 @@ class ChannelLogStream : public LogStream
{
private:
std::string channel;
-
+
public:
- ChannelLogStream(InspIRCd *Instance, const std::string &chan) : LogStream(Instance), channel(chan)
+ ChannelLogStream(InspIRCd *Instance, int loglevel, const std::string &chan) : LogStream(Instance, loglevel), channel(chan)
{
}
-
+
virtual void OnLog(int loglevel, const std::string &type, const std::string &msg)
{
Channel *c = ServerInstance->FindChan(channel);
-
+
+ if (loglevel < this->loglvl) return;
+
if (c)
{
// So this won't work remotely. Oh well.
@@ -45,15 +47,15 @@ class ModuleChanLog : public Module
public:
ModuleChanLog(InspIRCd* Me) : Module(Me)
{
- l = new ChannelLogStream(Me, "#services");
+ l = new ChannelLogStream(Me, ServerInstance->Config->LogLevel, "#services");
Me->Logs->AddLogType("*", l);
}
-
+
virtual ~ModuleChanLog()
{
delete l;
}
-
+
virtual Version GetVersion()
{
return Version(1,1,0,1,VF_VENDOR,API_VERSION);