Decorator pattern implementation for adding ANSI color codes to log messages. More...
#include <ConsoleColorDecorator.h>
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. | |
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.).
ConsoleColorDecorator::ConsoleColorDecorator | ( | FormativeFactory * | other_factory | ) |
Constructs a ConsoleColorDecorator wrapping another FormativeFactory.
other_factory | Pointer to the FormativeFactory to be decorated |
|
overridevirtual |
Formats and colors a log message based on its type.
type | The severity/type of the message |
context | The logging context (file, line, function) |
msg | The actual log message |
Implements FormativeFactory.