Application-wide logging singleton.
More...
#include <Logger.hpp>
|
| static void | Initialize (LogLevel level=LogLevel::Info, const std::string &logFile="") |
| | Initializes the logger with default configuration.
|
| |
| static LogLevel | fromStrLevel (const std::string &levelStr) |
| | Convert string to log level.
|
| |
| static void | SetInstance (std::shared_ptr< ILogger > logger) |
| | Sets a custom logger instance (for testing)
|
| |
| static std::shared_ptr< ILogger > | GetInstance () |
| | Gets the current logger instance.
|
| |
| template<typename... Args> |
| static void | Trace (fmt::format_string< Args... > fmt, Args &&... args) |
| |
| template<typename... Args> |
| static void | Debug (fmt::format_string< Args... > fmt, Args &&... args) |
| |
| template<typename... Args> |
| static void | Info (fmt::format_string< Args... > fmt, Args &&... args) |
| |
| template<typename... Args> |
| static void | Warn (fmt::format_string< Args... > fmt, Args &&... args) |
| |
| template<typename... Args> |
| static void | Error (fmt::format_string< Args... > fmt, Args &&... args) |
| |
| template<typename... Args> |
| static void | Critical (fmt::format_string< Args... > fmt, Args &&... args) |
| |
| static void | SetLevel (LogLevel level) |
| | Sets the global logging level.
|
| |
| static LogLevel | GetLevel () |
| | Gets the current logging level.
|
| |
Application-wide logging singleton.
Provides convenient static methods for logging throughout the application. Can be configured with a custom ILogger implementation for testing.
- Example Usage:
static void Debug(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logger.hpp:285
static void Error(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logger.hpp:303
static void Info(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logger.hpp:291
- Testing:
auto mockLogger = std::make_shared<MockLogger>();
static void SetInstance(std::shared_ptr< ILogger > logger)
Sets a custom logger instance (for testing)
Definition Logger.hpp:259
◆ Critical()
template<typename... Args>
| static void util::Logger::Critical |
( |
fmt::format_string< Args... > |
fmt, |
|
|
Args &&... |
args |
|
) |
| |
|
inlinestatic |
◆ Debug()
template<typename... Args>
| static void util::Logger::Debug |
( |
fmt::format_string< Args... > |
fmt, |
|
|
Args &&... |
args |
|
) |
| |
|
inlinestatic |
◆ Error()
template<typename... Args>
| static void util::Logger::Error |
( |
fmt::format_string< Args... > |
fmt, |
|
|
Args &&... |
args |
|
) |
| |
|
inlinestatic |
◆ fromStrLevel()
| static LogLevel util::Logger::fromStrLevel |
( |
const std::string & |
levelStr | ) |
|
|
inlinestatic |
Convert string to log level.
◆ GetInstance()
| static std::shared_ptr< ILogger > util::Logger::GetInstance |
( |
| ) |
|
|
inlinestatic |
Gets the current logger instance.
- Returns
- Shared pointer to logger
◆ GetLevel()
| static LogLevel util::Logger::GetLevel |
( |
| ) |
|
|
inlinestatic |
Gets the current logging level.
- Returns
- Current logging level
◆ Info()
template<typename... Args>
| static void util::Logger::Info |
( |
fmt::format_string< Args... > |
fmt, |
|
|
Args &&... |
args |
|
) |
| |
|
inlinestatic |
◆ Initialize()
Initializes the logger with default configuration.
- Parameters
-
| level | Initial logging level |
| logFile | Optional file path for file logging |
◆ SetInstance()
| static void util::Logger::SetInstance |
( |
std::shared_ptr< ILogger > |
logger | ) |
|
|
inlinestatic |
Sets a custom logger instance (for testing)
- Parameters
-
| logger | Custom logger implementation |
◆ SetLevel()
| static void util::Logger::SetLevel |
( |
LogLevel |
level | ) |
|
|
inlinestatic |
Sets the global logging level.
- Parameters
-
◆ Trace()
template<typename... Args>
| static void util::Logger::Trace |
( |
fmt::format_string< Args... > |
fmt, |
|
|
Args &&... |
args |
|
) |
| |
|
inlinestatic |
◆ Warn()
template<typename... Args>
| static void util::Logger::Warn |
( |
fmt::format_string< Args... > |
fmt, |
|
|
Args &&... |
args |
|
) |
| |
|
inlinestatic |
◆ s_instance
| std::shared_ptr< ILogger > util::Logger::s_instance = nullptr |
|
inlinestaticprivate |
The documentation for this class was generated from the following file: