Provides a thread-safe logging mechanism that writes messages to a file and Google Firestore.
More...
#include <Logger.h>
|
static void | init (const std::string &filename=defaultFileName) |
| Initializes the Logger with the specified file name.
|
|
static void | start () |
| Starts the logging process by spawning worker threads.
|
|
static void | stopLogger () |
| Stops all logging activity.
|
|
static void | logInfo (const std::string &message) |
| Logs an informational message.
|
|
static void | logError (const std::string &message) |
| Logs an error message.
|
|
static void | close () |
| Closes the Logger and cleans up resources.
|
|
|
static const std::string | defaultFileName = "app.log" |
| Default filename for local log files.
|
|
Provides a thread-safe logging mechanism that writes messages to a file and Google Firestore.
Logger is designed to be used across different parts of an application to log various messages like information and errors. It supports simultaneous file and Firestore logging and handles concurrent access using a queue-based system with multiple worker threads.
◆ close()
Closes the Logger and cleans up resources.
Ensures all logging activities are stopped and resources are released properly.
◆ init()
Initializes the Logger with the specified file name.
- Parameters
-
filename | Name of the file to which logs will be written. Defaults to 'defaultFileName'. |
◆ logError()
void Logger::logError |
( |
const std::string & | message | ) |
|
|
static |
Logs an error message.
- Parameters
-
message | The error message to log. |
◆ logInfo()
void Logger::logInfo |
( |
const std::string & | message | ) |
|
|
static |
Logs an informational message.
- Parameters
-
message | The info message to log. |
◆ start()
Starts the logging process by spawning worker threads.
Initializes worker threads that handle asynchronous log writing. Must be called after init.
◆ stopLogger()
void Logger::stopLogger |
( |
| ) |
|
|
static |
Stops all logging activity.
Signals worker threads to complete their tasks and stop running.
The documentation for this class was generated from the following files:
- include/utils/Logger.h
- src/utils/Logger.cpp