ACF $AcfVersion:0$
CStreamLogCompBase.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-2.1-or-later OR GPL-2.0-or-later OR GPL-3.0-or-later OR LicenseRef-ACF-Commercial
2#pragma once
3
4
5// ACF includes
6#include <ilog/CLogCompBase.h>
7
8
9namespace ilog
10{
11
12
78{
79public:
82
83 I_BEGIN_BASE_COMPONENT(CStreamLogCompBase);
84 I_ASSIGN(m_minPriorityAttrPtr, "MinCategory", "Minimal category of message to print it out:\n *1-Information\n *2-Warning\n *3-Error\n *4-Critical", true, 0);
85 I_ASSIGN(m_isDotEnabledAttrPtr, "ShowDots", "If it's true, dot will be shown for each ignored message", true, false);
86 I_ASSIGN(m_useCategoryAttrPtr, "UseCategory", "Use error category for the messsages (e.g warning or error)", true, true);
87 I_ASSIGN(m_useCodeAttrPtr, "UseCode", "Use error code for the messsages", true, true);
88 I_ASSIGN(m_useTimeStampAttrPtr, "UseTimeStamp", "Use time stamp for the messsages", true, false);
89 I_ASSIGN(m_timeFormatAttrPtr, "TimeFormat", "Format used for timestamp output", false, "dd.MM hh:mm:ss:zzz");
90 I_END_COMPONENT;
91
93
98
99 // reimplemented (ilog::IMessageConsumer)
100 virtual bool IsMessageSupported(
101 int messageCategory = -1,
102 int messageId = -1,
103 const istd::IInformationProvider* messagePtr = NULL) const override;
104
105protected:
110
114 virtual QString GenerateMessageText(const istd::IInformationProvider& message) const;
115
116 // abstract methods
117
121 virtual void WriteText(const QString& text, istd::IInformationProvider::InformationCategory category) = 0;
122
123 // reimplemented (ilog::CLogCompBase)
124 virtual void WriteMessageToLog(const MessagePtr& messagePtr) override;
125
126 // reimplemented (icomp::CComponentBase)
127 virtual void OnComponentDestroyed() override;
128
129private:
130 I_ATTR(int, m_minPriorityAttrPtr);
131 I_ATTR(bool, m_isDotEnabledAttrPtr);
132 I_ATTR(bool, m_useCategoryAttrPtr);
133 I_ATTR(bool, m_useCodeAttrPtr);
134 I_ATTR(bool, m_useTimeStampAttrPtr);
135 I_ATTR(QByteArray, m_timeFormatAttrPtr);
136
137 bool m_isLastDotShown;
140};
141
142
143} // namespace ilog
144
145
146
Base implementation for logging components using Qt event queue.
Base class for stream-based logging components.
virtual void WriteMessageToStream(const istd::IInformationProvider &message)
Write formatted message to the output stream.
virtual QString GenerateMessageText(const istd::IInformationProvider &message) const
Generate formatted message text for the output.
istd::IInformationProvider::InformationCategory GetWorseCategory() const
Get worse category (highest code) of all outputed messages.
virtual void WriteMessageToLog(const MessagePtr &messagePtr) override
Abstract method called to process a message.
virtual bool IsMessageSupported(int messageCategory=-1, int messageId=-1, const istd::IInformationProvider *messagePtr=NULL) const override
Check if a message is supported.
ilog::CLogCompBase BaseClass
Base class typedef.
virtual void OnComponentDestroyed() override
virtual void WriteText(const QString &text, istd::IInformationProvider::InformationCategory category)=0
Write a text line to the output stream.
Common interface for class providing some basic information object.
InformationCategory
Category of information.
Shared ownership smart pointer for interface types.
#define NULL
Definition istd.h:74
This namespace contains implementations for the logging functionality.