CCIMXDesktop
 
Loading...
Searching...
No Matches
ConsoleLogger Class Reference

A logger backend that outputs messages to the console. More...

#include <ConsoleLogger.h>

Inheritance diagram for ConsoleLogger:
DesktopLoggerBackends

Public Types

enum class  ConsoleFormatStyle { Plain , LoguruLike }
 Defines the available formatting styles for console output. More...
 
- Public Types inherited from DesktopLoggerBackends
enum  LogStatus { LogSuccess = 0 , LogDisabled = 1 , LogFailed = 2 }
 Status codes for log processing operations. More...
 

Public Member Functions

 ConsoleLogger (ConsoleFormatStyle type=ConsoleFormatStyle::Plain)
 Constructs a ConsoleLogger with specified format style.
 
 ~ConsoleLogger () override=default
 Destructor (default implementation)
 
bool postSelfStatus () override
 Posts the current status of the logger to the console.
 
- Public Member Functions inherited from DesktopLoggerBackends
 DesktopLoggerBackends (std::shared_ptr< FormativeFactory > factory, std::shared_ptr< LoggerBaseConsumer > consumer)
 Constructs a logger backend with formatter and consumer.
 
virtual ~DesktopLoggerBackends ()=default
 Virtual destructor.
 
virtual LogStatus processMessage (QtMsgType type, const QMessageLogContext &context, const QString &msg)
 Processes a log message through formatter and consumer.
 
void hot_install_factory (std::shared_ptr< FormativeFactory > factory)
 Replaces the formatter factory at runtime.
 
void hot_install_consumer (std::shared_ptr< LoggerBaseConsumer > consumer)
 Replaces the message consumer at runtime.
 

Additional Inherited Members

- Protected Attributes inherited from DesktopLoggerBackends
bool enabled { true }
 
QMutex lock
 
std::shared_ptr< FormativeFactoryformat_factory
 
std::shared_ptr< LoggerBaseConsumermessage_consume_backend
 

Detailed Description

A logger backend that outputs messages to the console.

This class implements a console-based logger that can format messages in different styles for console output.

Member Enumeration Documentation

◆ ConsoleFormatStyle

Defines the available formatting styles for console output.

Enumerator
Plain 

Simple plain text format

LoguruLike 

Format similar to Loguru logger (with colors and metadata)

Constructor & Destructor Documentation

◆ ConsoleLogger()

ConsoleLogger::ConsoleLogger ( ConsoleFormatStyle  type = ConsoleFormatStyle::Plain)
explicit

Constructs a ConsoleLogger with specified format style.

Parameters
typeThe formatting style to use (defaults to Plain)

Member Function Documentation

◆ postSelfStatus()

bool ConsoleLogger::postSelfStatus ( )
overridevirtual

Posts the current status of the logger to the console.

Returns
true if the status was successfully posted, false otherwise

Implements DesktopLoggerBackends.


The documentation for this class was generated from the following files: