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

Decorator pattern implementation for adding ANSI color codes to log messages. More...

#include <ConsoleColorDecorator.h>

Inheritance diagram for ConsoleColorDecorator:
FormativeFactory

Public Member Functions

 ConsoleColorDecorator (FormativeFactory *other_factory)
 Constructs a ConsoleColorDecorator wrapping another FormativeFactory.
 
 ~ConsoleColorDecorator () override=default
 Default destructor.
 
QString formativeFactory (QtMsgType type, const QMessageLogContext &context, const QString &msg) override
 Formats and colors a log message based on its type.
 

Detailed Description

Decorator pattern implementation for adding ANSI color codes to log messages.

This class extends FormativeFactory to add color formatting to log messages based on their message type (error, warning, info, etc.).

Constructor & Destructor Documentation

◆ ConsoleColorDecorator()

ConsoleColorDecorator::ConsoleColorDecorator ( FormativeFactory other_factory)

Constructs a ConsoleColorDecorator wrapping another FormativeFactory.

Parameters
other_factoryPointer to the FormativeFactory to be decorated

Member Function Documentation

◆ formativeFactory()

QString ConsoleColorDecorator::formativeFactory ( QtMsgType  type,
const QMessageLogContext &  context,
const QString &  msg 
)
overridevirtual

Formats and colors a log message based on its type.

Parameters
typeThe severity/type of the message
contextThe logging context (file, line, function)
msgThe actual log message
Returns
Formatted and colored message string

Implements FormativeFactory.


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