]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/logger.cpp
Merge branch 'master+websocket'
[user/henk/code/inspircd.git] / src / logger.cpp
index 564f0fdac00740c24ff16fe4d80a3e0d86c4922a..8bd5f7f88ac6697eb1ee09049db777f39b87bd80 100644 (file)
@@ -21,7 +21,6 @@
 
 
 #include "inspircd.h"
-#include "filelogger.h"
 
 /*
  * Suggested implementation...
@@ -51,8 +50,8 @@
  */
 
 const char LogStream::LogHeader[] =
-       "Log started for " VERSION " (" REVISION ", " MODULE_INIT_STR ")"
-       " - compiled on " SYSTEM;
+       "Log started for " INSPIRCD_VERSION " (" INSPIRCD_REVISION ", " MODULE_INIT_STR ")"
+       " - compiled on " INSPIRCD_SYSTEM;
 
 LogManager::LogManager()
        : Logging(false)
@@ -61,7 +60,6 @@ LogManager::LogManager()
 
 LogManager::~LogManager()
 {
-       CloseLogs();
 }
 
 void LogManager::OpenFileLogs()
@@ -113,7 +111,7 @@ void LogManager::OpenFileLogs()
                        loglevel = LOG_NONE;
                }
                FileWriter* fw;
-               std::string target = tag->getString("target");
+               std::string target = ServerInstance->Config->Paths.PrependLog(tag->getString("target"));
                std::map<std::string, FileWriter*>::iterator fwi = logmap.find(target);
                if (fwi == logmap.end())
                {
@@ -209,10 +207,9 @@ void LogManager::DelLogStream(LogStream* l)
 {
        for (std::map<std::string, std::vector<LogStream*> >::iterator i = LogStreams.begin(); i != LogStreams.end(); ++i)
        {
-               std::vector<LogStream*>::iterator it;
-               while ((it = std::find(i->second.begin(), i->second.end(), l)) != i->second.end())
+               while (stdalgo::erase(i->second, l))
                {
-                       i->second.erase(it);
+                       // Keep erasing while it exists
                }
        }
 
@@ -238,11 +235,8 @@ bool LogManager::DelLogType(const std::string &type, LogStream *l)
 
        if (i != LogStreams.end())
        {
-               std::vector<LogStream *>::iterator it = std::find(i->second.begin(), i->second.end(), l);
-
-               if (it != i->second.end())
+               if (stdalgo::erase(i->second, l))
                {
-                       i->second.erase(it);
                        if (i->second.size() == 0)
                        {
                                LogStreams.erase(i);
@@ -294,7 +288,7 @@ void LogManager::Log(const std::string &type, LogLevel loglevel, const std::stri
 
        for (std::map<LogStream *, std::vector<std::string> >::iterator gi = GlobalLogStreams.begin(); gi != GlobalLogStreams.end(); ++gi)
        {
-               if (std::find(gi->second.begin(), gi->second.end(), type) != gi->second.end())
+               if (stdalgo::isin(gi->second, type))
                {
                        continue;
                }