diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-10-21 23:46:13 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-10-21 23:46:13 +0000 |
commit | d8f98565a8617658f610bc94a5d87266930beee4 (patch) | |
tree | 365a153c59bc8b521b094c27f25b484a69e5154b /src/logger.cpp | |
parent | 984cc96a1f832abf9b5fcfddcd8260c5b12bd2a9 (diff) |
Use ConfigTagList as a faster access method for access to configuration
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11948 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/logger.cpp')
-rw-r--r-- | src/logger.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/logger.cpp b/src/logger.cpp index f1bbaa7ea..e92762b46 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -86,12 +86,10 @@ void LogManager::OpenFileLogs() } ConfigReader Conf; std::map<std::string, FileWriter*> logmap; - std::map<std::string, FileWriter*>::iterator i; - for (int index = 0;; ++index) + ConfigTagList tags = ServerInstance->Config->ConfTags("log"); + for(ConfigIter i = tags.first; i != tags.second; ++i) { - ConfigTag* tag = ServerInstance->Config->ConfValue("log", index); - if (!tag) - break; + ConfigTag* tag = i->second; std::string method = tag->getString("method"); if (method != "file") { @@ -122,8 +120,9 @@ void LogManager::OpenFileLogs() loglevel = NONE; } FileWriter* fw; - std::string target = Conf.ReadValue("log", "target", index); - if ((i = logmap.find(target)) == logmap.end()) + std::string target = tag->getString("target"); + std::map<std::string, FileWriter*>::iterator fwi = logmap.find(target); + if (fwi == logmap.end()) { FILE* f = fopen(target.c_str(), "a"); fw = new FileWriter(f); @@ -131,7 +130,7 @@ void LogManager::OpenFileLogs() } else { - fw = i->second; + fw = fwi->second; } FileLogStream* fls = new FileLogStream(loglevel, fw); AddLogTypes(type, fls, true); |