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
}
 

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.
 
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.

Definition at line 35 of file logging.h.

36 {
37 TRACE, ///< Trace level for detailed debugging information.
38 DEBUG, ///< Debug level for general debugging information.
39 INFO, ///< Info level for informational messages.
40 WARNING, ///< Warning level for potentially harmful situations.
41 ERROR, ///< Error level for error events.
42 FATAL ///< Fatal level for severe error events.
43 };
@ 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.
@ 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 121 of file logging.h.

122 {
123 switch (level)
124 {
125 case Level::TRACE:
126 return "TRACE";
127 case Level::DEBUG:
128 return "DEBUG";
129 case Level::INFO:
130 return "INFO";
131 case Level::WARNING:
132 return "WARNING";
133 case Level::ERROR:
134 return "ERROR";
135 case Level::FATAL:
136 return "FATAL";
137 default:
138 return "UNKNOWN";
139 }
140 }

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

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

+ Here is the caller graph for this function:

◆ getLevelString() [2/2]

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

Definition at line 25 of file main.cpp.

26 {
27 switch (l)
28 {
29 case FERS_LOG_TRACE:
30 return "TRACE";
31 case FERS_LOG_DEBUG:
32 return "DEBUG";
33 case FERS_LOG_INFO:
34 return "INFO";
36 return "WARNING";
37 case FERS_LOG_ERROR:
38 return "ERROR";
39 case FERS_LOG_FATAL:
40 return "FATAL";
41 default:
42 return "UNKNOWN";
43 }
44 }
@ FERS_LOG_FATAL
Definition api.h:82
@ FERS_LOG_DEBUG
Definition api.h:78
@ FERS_LOG_ERROR
Definition api.h:81
@ FERS_LOG_INFO
Definition api.h:79
@ FERS_LOG_TRACE
Definition api.h:77
@ FERS_LOG_WARNING
Definition api.h:80

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 152 of file logging.h.

153 {
154 logger.log(level, location, formatStr, std::forward<Args>(args)...);
155 }
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:37
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_log(), and log().