ekf_cal  0.4.0
A Kalman filter-based sensor calibration package
debug_logger.hpp
1 // Copyright 2022 Jacob Hartzer
2 //
3 // This program is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, either version 3 of the License, or
6 // (at your option) any later version.
7 //
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with this program. If not, see <https://www.gnu.org/licenses/>.
15 
16 #ifndef INFRASTRUCTURE__DEBUG_LOGGER_HPP_
17 #define INFRASTRUCTURE__DEBUG_LOGGER_HPP_
18 
19 
20 #include <stddef.h>
21 
22 #include <string>
23 
24 enum class LogLevel
25 {
26  FATAL,
27  ERROR,
28  WARN,
29  INFO,
30  DEBUG
31 };
32 
37 {
38 public:
44  DebugLogger(LogLevel log_level, const std::string & log_directory);
45 
51  DebugLogger(unsigned int log_level, const std::string & log_directory);
52 
58  void Log(LogLevel level, const std::string & message);
59 
64  void SetLogLevel(LogLevel level);
65 
70  void SetLogLevel(unsigned int level);
71 
72 private:
73  LogLevel m_log_level;
74  std::string m_log_directory;
75  std::string m_log_level_names[5] = {"FATAL", "ERROR", "WARN ", "INFO ", "DEBUG"};
76 };
77 
78 #endif // INFRASTRUCTURE__DEBUG_LOGGER_HPP_
DebugLogger class.
Definition: debug_logger.hpp:37
DebugLogger(LogLevel log_level, const std::string &log_directory)
DebugLogger Constructor.
Definition: debug_logger.cpp:21
void SetLogLevel(LogLevel level)
Function to set the log level.
Definition: ros_debug_logger.cpp:26
void Log(LogLevel level, const std::string &message)
Log message.
Definition: ros_debug_logger.cpp:48