LogLevel.cpp
Go to the documentation of this file.
00001 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
00002 
00003 // -- BEGIN LICENSE BLOCK ----------------------------------------------
00004 // This file is part of FZIs ic_workspace.
00005 //
00006 // This program is free software licensed under the LGPL
00007 // (GNU LESSER GENERAL PUBLIC LICENSE Version 3).
00008 // You can find a copy of this license in LICENSE folder in the top
00009 // directory of the source code.
00010 //
00011 // © Copyright 2016 FZI Forschungszentrum Informatik, Karlsruhe, Germany
00012 //
00013 // -- END LICENSE BLOCK ------------------------------------------------
00014 
00015 //----------------------------------------------------------------------
00022 //----------------------------------------------------------------------
00023 #include "LogLevel.h"
00024 
00025 #include <icl_core/BaseTypes.h>
00026 
00027 namespace icl_core {
00028 namespace logging {
00029 
00030 const char *log_level_descriptions[] =
00031 {
00032   "Trace",
00033   "Debug",
00034   "Info",
00035   "Warning",
00036   "Error",
00037   "Mute",
00038   NULL
00039 };
00040 
00041 const char *logLevelDescription(LogLevel log_level)
00042 {
00043   if (log_level < eLL_TRACE || log_level > eLL_MUTE)
00044   {
00045     return "";
00046   }
00047   else
00048   {
00049     return log_level_descriptions[log_level];
00050   }
00051 }
00052 
00053 bool stringToLogLevel(const std::string& log_level_text, LogLevel& log_level)
00054 {
00055   for (size_t index = 0; index <= eLL_MUTE; ++index)
00056   {
00057     if (log_level_text == log_level_descriptions[index])
00058     {
00059       log_level = LogLevel(index);
00060       return true;
00061     }
00062   }
00063 
00064   return false;
00065 }
00066 
00068 #ifdef _IC_BUILDER_DEPRECATED_STYLE_
00069 
00070 const char *LogLevelDescription(LogLevel log_level)
00071 {
00072   return logLevelDescription(log_level);
00073 }
00074 
00075 bool StringToLogLevel(const std::string& log_level_text, LogLevel& log_level)
00076 {
00077   return stringToLogLevel(log_level_text, log_level);
00078 }
00079 
00080 #endif
00081 
00082 
00083 }
00084 }


fzi_icl_core
Author(s):
autogenerated on Thu Jun 6 2019 20:22:24