CCIMXDesktop
 
Loading...
Searching...
No Matches
DesktopLoggerBackends.h
1#ifndef DESKTOPLOGGERBACKENDS_H
2#define DESKTOPLOGGERBACKENDS_H
3
4#include "library/simple_gerseter/simple_getseter.hpp"
5#include <QMutex>
6#include <QString>
7#include <QtLogging>
8
9class QMessageLogContext;
10class QString;
13
22public:
23 DesktopLoggerBackends() = delete;
24
30 DesktopLoggerBackends(std::shared_ptr<FormativeFactory> factory,
31 std::shared_ptr<LoggerBaseConsumer> consumer);
32
36 virtual ~DesktopLoggerBackends() = default;
37
47
55 virtual LogStatus processMessage(QtMsgType type,
56 const QMessageLogContext& context,
57 const QString& msg);
58
64 virtual bool postSelfStatus() = 0;
65
66 __PROPERTY_GETSET(bool, enabled);
67
72 void hot_install_factory(std::shared_ptr<FormativeFactory> factory);
73
78 void hot_install_consumer(std::shared_ptr<LoggerBaseConsumer> consumer);
79
80protected:
81 bool enabled { true };
82 QMutex lock;
83 std::shared_ptr<FormativeFactory> format_factory;
84 std::shared_ptr<LoggerBaseConsumer> message_consume_backend;
85};
86
87#endif // DESKTOPLOGGERBACKENDS_H
Definition FormativeFactory.h:5
The LoggerBaseConsumer class as consumer type.
Definition LoggerBaseConsumer.h:8
Base class for all desktop logger backend implementations.
Definition DesktopLoggerBackends.h:21
std::shared_ptr< LoggerBaseConsumer > message_consume_backend
Definition DesktopLoggerBackends.h:84
virtual ~DesktopLoggerBackends()=default
Virtual destructor.
void hot_install_factory(std::shared_ptr< FormativeFactory > factory)
Replaces the formatter factory at runtime.
Definition DesktopLoggerBackends.cpp:21
QMutex lock
Definition DesktopLoggerBackends.h:82
bool enabled
Definition DesktopLoggerBackends.h:81
std::shared_ptr< FormativeFactory > format_factory
Definition DesktopLoggerBackends.h:83
LogStatus
Status codes for log processing operations.
Definition DesktopLoggerBackends.h:42
@ LogSuccess
Definition DesktopLoggerBackends.h:43
@ LogFailed
Definition DesktopLoggerBackends.h:45
@ LogDisabled
Definition DesktopLoggerBackends.h:44
virtual bool postSelfStatus()=0
Posts the current status of the logger.
virtual LogStatus processMessage(QtMsgType type, const QMessageLogContext &context, const QString &msg)
Processes a log message through formatter and consumer.
Definition DesktopLoggerBackends.cpp:6
void hot_install_consumer(std::shared_ptr< LoggerBaseConsumer > consumer)
Replaces the message consumer at runtime.
Definition DesktopLoggerBackends.cpp:30