![]() |
IRSOL
C++ code implementing socket server for interacting with Baumer camera.
|
Logging macros, types, and functions for the irsol library. More...
Files | |
file | logging.hpp |
Logging utilities and configuration for the irsol library. | |
Classes | |
struct | irsol::internal::LoggerInfo |
Metadata for a named logger instance. More... | |
class | irsol::internal::NamedLoggerRegistry |
Manages a registry of named loggers. More... | |
Macros | |
#define | IRSOL_LOG_TRACE(...) SPDLOG_TRACE(__VA_ARGS__) |
Logs a trace-level message using the default logger. | |
#define | IRSOL_LOG_DEBUG(...) SPDLOG_DEBUG(__VA_ARGS__) |
Logs a debug-level message using the default logger. | |
#define | IRSOL_LOG_INFO(...) SPDLOG_INFO(__VA_ARGS__) |
Logs an info-level message using the default logger. | |
#define | IRSOL_LOG_WARN(...) SPDLOG_WARN(__VA_ARGS__) |
Logs a warning-level message using the default logger. | |
#define | IRSOL_LOG_ERROR(...) SPDLOG_ERROR(__VA_ARGS__) |
Logs an error-level message using the default logger. | |
#define | IRSOL_LOG_FATAL(...) SPDLOG_CRITICAL(__VA_ARGS__) |
Logs a fatal (critical) message using the default logger. | |
#define | IRSOL_NAMED_LOG_TRACE(name, ...) irsol::internal::NamedLoggerRegistry::getLogger(name)->trace(__VA_ARGS__) |
Logs a trace-level message using a named logger. | |
#define | IRSOL_NAMED_LOG_DEBUG(name, ...) irsol::internal::NamedLoggerRegistry::getLogger(name)->debug(__VA_ARGS__) |
Logs a debug-level message using a named logger. | |
#define | IRSOL_NAMED_LOG_INFO(name, ...) irsol::internal::NamedLoggerRegistry::getLogger(name)->info(__VA_ARGS__) |
Logs an info-level message using a named logger. | |
#define | IRSOL_NAMED_LOG_WARN(name, ...) irsol::internal::NamedLoggerRegistry::getLogger(name)->warn(__VA_ARGS__) |
Logs a warning-level message using a named logger. | |
#define | IRSOL_NAMED_LOG_ERROR(name, ...) irsol::internal::NamedLoggerRegistry::getLogger(name)->error(__VA_ARGS__) |
Logs an error-level message using a named logger. | |
#define | IRSOL_NAMED_LOG_FATAL(name, ...) irsol::internal::NamedLoggerRegistry::getLogger(name)->critical(__VA_ARGS__) |
Logs a fatal (critical) message using a named logger. | |
Enumerations | |
enum class | irsol::LoggingFormat { irsol::LoggingFormat::CONSOLE , irsol::LoggingFormat::FILE , irsol::LoggingFormat::UNIT_TESTS } |
Enum representing supported logging output formats. More... | |
Functions | |
void | irsol::setLoggingFormat (LoggingFormat format=LoggingFormat::FILE, std::optional< std::shared_ptr< spdlog::logger > > logger=std::nullopt) |
Sets the global logging format. | |
void | irsol::setSinkLoggingFormat (LoggingFormat format, std::shared_ptr< spdlog::sinks::sink > sink) |
Sets the logging format for a specific sink. | |
void | irsol::setLoggerName (const char *name) |
Sets the name of the default logger. | |
void | irsol::initLogging (const char *fileSinkFilename="logs/irsol.log", std::optional< spdlog::level::level_enum > minLogLevel=std::nullopt) |
Initializes the irsol logging system. | |
Variables | |
const std::unordered_map< std::string, spdlog::level::level_enum > | irsol::levelNameToLevelMap |
Runtime map from string names to spdlog log levels. | |
Logging macros, types, and functions for the irsol library.
This group contains macros and helper utilities to log messages with different severity levels, configure logger output formats, and handle named loggers.
#define IRSOL_LOG_DEBUG | ( | ... | ) | SPDLOG_DEBUG(__VA_ARGS__) |
Logs a debug-level message using the default logger.
Definition at line 91 of file logging.hpp.
#define IRSOL_LOG_ERROR | ( | ... | ) | SPDLOG_ERROR(__VA_ARGS__) |
Logs an error-level message using the default logger.
Definition at line 94 of file logging.hpp.
#define IRSOL_LOG_FATAL | ( | ... | ) | SPDLOG_CRITICAL(__VA_ARGS__) |
Logs a fatal (critical) message using the default logger.
Definition at line 95 of file logging.hpp.
#define IRSOL_LOG_INFO | ( | ... | ) | SPDLOG_INFO(__VA_ARGS__) |
Logs an info-level message using the default logger.
Definition at line 92 of file logging.hpp.
#define IRSOL_LOG_TRACE | ( | ... | ) | SPDLOG_TRACE(__VA_ARGS__) |
Logs a trace-level message using the default logger.
Definition at line 90 of file logging.hpp.
#define IRSOL_LOG_WARN | ( | ... | ) | SPDLOG_WARN(__VA_ARGS__) |
Logs a warning-level message using the default logger.
Definition at line 93 of file logging.hpp.
#define IRSOL_NAMED_LOG_DEBUG | ( | name, | |
... | |||
) | irsol::internal::NamedLoggerRegistry::getLogger(name)->debug(__VA_ARGS__) |
Logs a debug-level message using a named logger.
Definition at line 174 of file logging.hpp.
#define IRSOL_NAMED_LOG_ERROR | ( | name, | |
... | |||
) | irsol::internal::NamedLoggerRegistry::getLogger(name)->error(__VA_ARGS__) |
Logs an error-level message using a named logger.
Definition at line 180 of file logging.hpp.
#define IRSOL_NAMED_LOG_FATAL | ( | name, | |
... | |||
) | irsol::internal::NamedLoggerRegistry::getLogger(name)->critical(__VA_ARGS__) |
Logs a fatal (critical) message using a named logger.
Definition at line 182 of file logging.hpp.
#define IRSOL_NAMED_LOG_INFO | ( | name, | |
... | |||
) | irsol::internal::NamedLoggerRegistry::getLogger(name)->info(__VA_ARGS__) |
Logs an info-level message using a named logger.
Definition at line 176 of file logging.hpp.
#define IRSOL_NAMED_LOG_TRACE | ( | name, | |
... | |||
) | irsol::internal::NamedLoggerRegistry::getLogger(name)->trace(__VA_ARGS__) |
Logs a trace-level message using a named logger.
Definition at line 172 of file logging.hpp.
#define IRSOL_NAMED_LOG_WARN | ( | name, | |
... | |||
) | irsol::internal::NamedLoggerRegistry::getLogger(name)->warn(__VA_ARGS__) |
Logs a warning-level message using a named logger.
Definition at line 178 of file logging.hpp.
|
strongprivate |
Enum representing supported logging output formats.
Enumerator | |
---|---|
CONSOLE | Human-readable format for terminal output. |
FILE | Persistent file logging format. |
UNIT_TESTS | Format suitable for unit test frameworks. |
Definition at line 191 of file logging.hpp.
|
private |
Initializes the irsol
logging system.
Creates and configures the global logger instance. This should typically be called once at application startup.
fileSinkFilename | Path to the log file where logs are written to. |
minLogLevel | Optional minimum log level to use at runtime. |
Definition at line 108 of file logging.cpp.
|
private |
Sets the name of the default logger.
Use this to label logs with a custom identifier. Useful for distinguishing between multiple libraries or subsystems.
name | The desired logger name. |
Definition at line 77 of file logging.cpp.
|
private |
Sets the global logging format.
This function configures the default output format (e.g., console, file).
format | The desired output format. |
logger | Optional logger instance to configure, if not provided the format is set to default logger. |
Definition at line 84 of file logging.cpp.
|
private |
Sets the logging format for a specific sink.
Applies the appropriate formatter string to the given sink (e.g., console, file).
format | The desired output format. |
sink | The sink to configure. |
Definition at line 92 of file logging.cpp.
|
inlineprivate |
Runtime map from string names to spdlog log levels.
Allows dynamic parsing of log levels from configuration or user input.
Definition at line 254 of file logging.hpp.