Go to the documentation of this file.00001
00002
00009
00010 #include "LogLevel.h"
00011
00012 #include <icl_core/BaseTypes.h>
00013
00014 namespace icl_core {
00015 namespace logging {
00016
00017 const char *log_level_descriptions[] =
00018 {
00019 "Trace",
00020 "Debug",
00021 "Info",
00022 "Warning",
00023 "Error",
00024 "Mute",
00025 NULL
00026 };
00027
00028 const char *logLevelDescription(LogLevel log_level)
00029 {
00030 if (log_level < eLL_TRACE || log_level > eLL_MUTE)
00031 {
00032 return "";
00033 }
00034 else
00035 {
00036 return log_level_descriptions[log_level];
00037 }
00038 }
00039
00040 bool stringToLogLevel(const std::string& log_level_text, LogLevel& log_level)
00041 {
00042 for (size_t index = 0; index <= eLL_MUTE; ++index)
00043 {
00044 if (log_level_text == log_level_descriptions[index])
00045 {
00046 log_level = LogLevel(index);
00047 return true;
00048 }
00049 }
00050
00051 return false;
00052 }
00053
00055 #ifdef _IC_BUILDER_DEPRECATED_STYLE_
00056
00057 const char *LogLevelDescription(LogLevel log_level)
00058 {
00059 return logLevelDescription(log_level);
00060 }
00061
00062 bool StringToLogLevel(const std::string& log_level_text, LogLevel& log_level)
00063 {
00064 return stringToLogLevel(log_level_text, log_level);
00065 }
00066
00067 #endif
00068
00069
00070 }
00071 }