From d8f98565a8617658f610bc94a5d87266930beee4 Mon Sep 17 00:00:00 2001 From: danieldg Date: Wed, 21 Oct 2009 23:46:13 +0000 Subject: 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 --- src/logger.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src/logger.cpp') 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 logmap; - std::map::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::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); -- cgit v1.3.1-10-gc9f91