LogLevel.cpp
Go to the documentation of this file.
1 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
2 
3 // -- BEGIN LICENSE BLOCK ----------------------------------------------
4 // This file is part of FZIs ic_workspace.
5 //
6 // This program is free software licensed under the LGPL
7 // (GNU LESSER GENERAL PUBLIC LICENSE Version 3).
8 // You can find a copy of this license in LICENSE folder in the top
9 // directory of the source code.
10 //
11 // © Copyright 2016 FZI Forschungszentrum Informatik, Karlsruhe, Germany
12 //
13 // -- END LICENSE BLOCK ------------------------------------------------
14 
15 //----------------------------------------------------------------------
22 //----------------------------------------------------------------------
23 #include "LogLevel.h"
24 
25 #include <icl_core/BaseTypes.h>
26 
27 namespace icl_core {
28 namespace logging {
29 
30 const char *log_level_descriptions[] =
31 {
32  "Trace",
33  "Debug",
34  "Info",
35  "Warning",
36  "Error",
37  "Mute",
38  NULL
39 };
40 
41 const char *logLevelDescription(LogLevel log_level)
42 {
43  if (log_level < eLL_TRACE || log_level > eLL_MUTE)
44  {
45  return "";
46  }
47  else
48  {
49  return log_level_descriptions[log_level];
50  }
51 }
52 
53 bool stringToLogLevel(const std::string& log_level_text, LogLevel& log_level)
54 {
55  for (size_t index = 0; index <= eLL_MUTE; ++index)
56  {
57  if (log_level_text == log_level_descriptions[index])
58  {
59  log_level = LogLevel(index);
60  return true;
61  }
62  }
63 
64  return false;
65 }
66 
68 #ifdef _IC_BUILDER_DEPRECATED_STYLE_
69 
70 const char *LogLevelDescription(LogLevel log_level)
71 {
72  return logLevelDescription(log_level);
73 }
74 
75 bool StringToLogLevel(const std::string& log_level_text, LogLevel& log_level)
76 {
77  return stringToLogLevel(log_level_text, log_level);
78 }
79 
80 #endif
81 
83 }
84 }
const char * log_level_descriptions[]
Definition: LogLevel.cpp:30
bool stringToLogLevel(const std::string &log_level_text, LogLevel &log_level)
Definition: LogLevel.cpp:53
Contains icl_logging::LogLevel.
Contains Interface base classes and base types.
const char * logLevelDescription(LogLevel log_level)
Definition: LogLevel.cpp:41


fzi_icl_core
Author(s):
autogenerated on Mon Jun 10 2019 13:17:58