CrossGuard
Loading...
Searching...
No Matches
Static Public Member Functions | Static Public Attributes | List of all members
Logger Class Reference

Provides a thread-safe logging mechanism that writes messages to a file and Google Firestore. More...

#include <Logger.h>

Static Public Member Functions

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 Public Attributes

static const std::string defaultFileName = "app.log"
 Default filename for local log files.
 

Detailed Description

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.

Member Function Documentation

◆ close()

void Logger::close ( )
static

Closes the Logger and cleans up resources.

Ensures all logging activities are stopped and resources are released properly.

◆ init()

void Logger::init ( const std::string & filename = defaultFileName)
static

Initializes the Logger with the specified file name.

Parameters
filenameName 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
messageThe error message to log.

◆ logInfo()

void Logger::logInfo ( const std::string & message)
static

Logs an informational message.

Parameters
messageThe info message to log.

◆ start()

void Logger::start ( )
static

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: