aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSpp <spp@jorge.gr>2012-08-27 12:56:45 +0200
committerShauren <shauren.trinity@gmail.com>2012-08-27 12:56:45 +0200
commit5aee9433e118c2ac27a135cfa8deb3446f498396 (patch)
tree5a9f4464f8d0256012d26c6f7b743b456bdd4577
parent30e41724e43c9669d10771836eebd79743c56518 (diff)
Core/Logging: Minor optimization in ShouldLog
-rwxr-xr-xsrc/server/shared/Logging/Log.cpp14
1 files changed, 3 insertions, 11 deletions
diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp
index 3a24190d8fa..6e17a32c78b 100755
--- a/src/server/shared/Logging/Log.cpp
+++ b/src/server/shared/Logging/Log.cpp
@@ -260,14 +260,9 @@ void Log::ReadLoggersFromConfig()
}
while (ss);
- LoggerMap::const_iterator it = loggers.begin();
-
- while (it != loggers.end() && it->first)
- ++it;
-
// root logger must exist. Marking as disabled as its not configured
- if (it == loggers.end())
- loggers[0].Create("root", LOG_FILTER_GENERAL, LOG_LEVEL_DISABLED);
+ if (loggers.find(LOG_FILTER_GENERAL) == loggers.end())
+ loggers[LOG_FILTER_GENERAL].Create("root", LOG_FILTER_GENERAL, LOG_LEVEL_DISABLED);
}
void Log::EnableDBAppenders()
@@ -349,10 +344,7 @@ bool Log::SetLogLevel(std::string const& name, const char* newLevelc, bool isLog
bool Log::ShouldLog(LogFilterType type, LogLevel level) const
{
- LoggerMap::const_iterator it = loggers.begin();
- while (it != loggers.end() && it->second.getType() != type)
- ++it;
-
+ LoggerMap::const_iterator it = loggers.find(type);
if (it != loggers.end())
{
LogLevel loggerLevel = it->second.getLogLevel();