FERS 1.0.0
The Flexible Extensible Radar Simulator
Loading...
Searching...
No Matches
logging Namespace Reference

Classes

class  Logger
 Thread-safe logger class for handling logging operations. More...
 

Enumerations

enum class  Level {
  TRACE , DEBUG , INFO , WARNING ,
  ERROR , FATAL , OFF
}
 

Functions

std::string getLevelString (const Level level) noexcept
 Converts a log level enum value to its string representation.
 
template<typename... Args>
void log (Level level, const std::source_location &location, const std::string &formatStr, Args &&... args) noexcept
 Logs a formatted message with a specific log level and source location.
 
static std::string getLevelString (fers_log_level_t l)
 

Variables

Logger logger
 Externally available logger object.
 

Enumeration Type Documentation

◆ Level

enum class logging::Level
strong
Enumerator
TRACE 

Trace level for detailed debugging information.

DEBUG 

Debug level for general debugging information.

INFO 

Info level for informational messages.

WARNING 

Warning level for potentially harmful situations.

ERROR 

Error level for error events.

FATAL 

Fatal level for severe error events.

OFF 

Special level to disable all logging.

Definition at line 37 of file logging.h.

38 {
39 TRACE, ///< Trace level for detailed debugging information.
40 DEBUG, ///< Debug level for general debugging information.
41 INFO, ///< Info level for informational messages.
42 WARNING, ///< Warning level for potentially harmful situations.
43 ERROR, ///< Error level for error events.
44 FATAL, ///< Fatal level for severe error events.
45 OFF ///< Special level to disable all logging.
46 };
@ WARNING
Warning level for potentially harmful situations.
@ FATAL
Fatal level for severe error events.
@ TRACE
Trace level for detailed debugging information.
@ INFO
Info level for informational messages.
@ OFF
Special level to disable all logging.
@ ERROR
Error level for error events.
@ DEBUG
Debug level for general debugging information.

Function Documentation

◆ getLevelString() [1/2]

std::string logging::getLevelString ( const Level  level)
noexcept

Converts a log level enum value to its string representation.

Parameters
levelThe log level.
Returns
A string representing the log level.

Definition at line 143 of file logging.h.

144 {
145 switch (level)
146 {
147 case Level::TRACE:
148 return "TRACE";
149 case Level::DEBUG:
150 return "DEBUG";
151 case Level::INFO:
152 return "INFO";
153 case Level::WARNING:
154 return "WARNING";
155 case Level::ERROR:
156 return "ERROR";
157 case Level::FATAL:
158 return "FATAL";
159 case Level::OFF:
160 return "OFF";
161 default:
162 return "UNKNOWN";
163 }
164 }

References DEBUG, ERROR, FATAL, INFO, OFF, TRACE, and WARNING.

Referenced by logging::Logger::log(), and main().

+ Here is the caller graph for this function:

◆ getLevelString() [2/2]

static std::string logging::getLevelString ( fers_log_level_t  l)
static

Definition at line 26 of file main.cpp.

27 {
28 switch (l)
29 {
30 case FERS_LOG_TRACE:
31 return "TRACE";
32 case FERS_LOG_DEBUG:
33 return "DEBUG";
34 case FERS_LOG_INFO:
35 return "INFO";
37 return "WARNING";
38 case FERS_LOG_ERROR:
39 return "ERROR";
40 case FERS_LOG_FATAL:
41 return "FATAL";
42 default:
43 return "UNKNOWN";
44 }
45 }
@ FERS_LOG_FATAL
Definition api.h:92
@ FERS_LOG_DEBUG
Definition api.h:88
@ FERS_LOG_ERROR
Definition api.h:91
@ FERS_LOG_INFO
Definition api.h:89
@ FERS_LOG_TRACE
Definition api.h:87
@ FERS_LOG_WARNING
Definition api.h:90

References FERS_LOG_DEBUG, FERS_LOG_ERROR, FERS_LOG_FATAL, FERS_LOG_INFO, FERS_LOG_TRACE, and FERS_LOG_WARNING.

◆ log()

template<typename... Args>
void logging::log ( Level  level,
const std::source_location &  location,
const std::string &  formatStr,
Args &&...  args 
)
noexcept

Logs a formatted message with a specific log level and source location.

Template Parameters
ArgsVariadic template for format arguments.
Parameters
levelThe log level.
locationThe source location of the log call.
formatStrThe format string.
argsThe format arguments.

Definition at line 176 of file logging.h.

177 {
178 logger.log(level, location, formatStr, std::forward<Args>(args)...);
179 }
void log(Level level, const std::string &message, const std::source_location &location=std::source_location::current()) noexcept
Logs a message with a specific log level and source location.
Definition logging.cpp:45
Logger logger
Externally available logger object.
Definition logging.cpp:23

References logging::Logger::log(), and logger.

+ Here is the call graph for this function:

Variable Documentation

◆ logger

Logger logging::logger

Externally available logger object.

Definition at line 23 of file logging.cpp.

Referenced by fers_configure_logging(), fers_get_log_level(), fers_log(), fers_set_log_callback(), and log().