#include <Logger.h>
|
| static void | Init (const std::string &loggerName="async_logger", const std::string &logFilePath="logs/app.log", const bool enableConsole=true, const bool enableFile=true, const spdlog::level::level_enum globalLevel=spdlog::level::trace, const size_t queueSize=8192, const size_t numThreads=1, size_t maxFileSize=1024 *1024 *300, size_t maxFiles=5, spdlog::sink_ptr customSink=nullptr) |
| | Initializes the spdlog and sets up the sources and sinks NOTE: Use Shutdown to clean up and dump all queue.
|
| |
| static void | Shutdown () |
| |
◆ GenerateTimestampedFilename()
| static std::string logging::Logger::GenerateTimestampedFilename |
( |
const std::string & |
baseLogPath | ) |
|
|
inlinestaticprivate |
Generates a timestamped filename.
- Parameters
-
| baseLogPath | Base path (e.g., "logs/app.log") |
- Returns
- Timestamped path (e.g., "logs/app_2025-10-30_14-30-45.log")
◆ Init()
| static void logging::Logger::Init |
( |
const std::string & |
loggerName = "async_logger", |
|
|
const std::string & |
logFilePath = "logs/app.log", |
|
|
const bool |
enableConsole = true, |
|
|
const bool |
enableFile = true, |
|
|
const spdlog::level::level_enum |
globalLevel = spdlog::level::trace, |
|
|
const size_t |
queueSize = 8192, |
|
|
const size_t |
numThreads = 1, |
|
|
size_t |
maxFileSize = 1024 * 1024 * 300, |
|
|
size_t |
maxFiles = 5, |
|
|
spdlog::sink_ptr |
customSink = nullptr |
|
) |
| |
|
inlinestatic |
Initializes the spdlog and sets up the sources and sinks NOTE: Use Shutdown to clean up and dump all queue.
- Parameters
-
| loggerName | Unique name for the logger |
| logFilePath | Place to save the log file (timestamp will be added automatically) |
| enableConsole | to use the console based logging or not |
| enableFile | to use the file based logging or not |
| globalLevel | Level of log, default is trace |
| queueSize | queue size of the logging queue |
| numThreads | number of threads used by logger |
| maxFileSize | maximum file size of the log file |
| maxFiles | total number of files used by logger |
| customSink | an optional custom sink to add (e.g., for testing) |
◆ Shutdown()
| static void logging::Logger::Shutdown |
( |
| ) |
|
|
inlinestatic |
Clean up the logging threads and dump up the remaining logs in queue
The documentation for this class was generated from the following file: