ICF 3.0.5.47
Technical documentation of ICF Libraries
CStreamLogCompBase.h
Go to the documentation of this file.
1/********************************************************************************
2** This file is part of the ICF Framework. Copyright (C) Witold Gantzke & Kirill Lepskiy
3** ICF Framework may be used under the terms of the LGPL License v. 2.1 by the Free Software Foundation.
4********************************************************************************/
5
6#ifndef ilog_CStreamLogCompBase_included
7#define ilog_CStreamLogCompBase_included
8
9
10// ICF includes
11#include <ilog/CLogCompBase.h>
12
13
14namespace ilog
15{
16
17
24{
25public:
27
28 I_BEGIN_BASE_COMPONENT(CStreamLogCompBase);
29 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);
30 I_ASSIGN(m_isDotEnabledAttrPtr, "ShowDots", "If it's true, dot will be shown for each ignored message", true, false);
31 I_ASSIGN(m_useCategoryAttrPtr, "UseCategory", "Use error category for the messsages (e.g warning or error)", true, true);
32 I_ASSIGN(m_useCodeAttrPtr, "UseCode", "Use error code for the messsages", true, true);
33 I_ASSIGN(m_useTimeStampAttrPtr, "UseTimeStamp", "Use time stamp for the messsages", true, false);
34 I_ASSIGN(m_timeFormatAttrPtr, "TimeFormat", "Format used for timestamp output", false, "dd.MM hh:mm:ss:zzz");
35 I_END_COMPONENT;
36
38
43
44 // reimplemented (ilog::IMessageConsumer)
46 int messageCategory = -1,
47 int messageId = -1,
48 const QByteArray* senderIdPtr = nullptr) const override;
49
50protected:
55
59 virtual QString GenerateMessageText(const istd::IInformationProvider& message) const;
60
61 // abstract methods
62
66 virtual void WriteText(const QString& text, istd::IInformationProvider::InformationCategory category) = 0;
67
68 // reimplemented (ilog::CLogCompBase)
69 void WriteMessageToLog(const MessagePtr& messagePtr) override;
70
71 // reimplemented (icomp::CComponentBase)
72 void OnComponentDestroyed() override;
73
74private:
75 I_ATTR(int, m_minPriorityAttrPtr);
76 I_ATTR(bool, m_isDotEnabledAttrPtr);
77 I_ATTR(bool, m_useCategoryAttrPtr);
78 I_ATTR(bool, m_useCodeAttrPtr);
79 I_ATTR(bool, m_useTimeStampAttrPtr);
80 I_ATTR(QByteArray, m_timeFormatAttrPtr);
81
82 bool m_isLastDotShown;
85};
86
87
88} // namespace ilog
89
90
91#endif // !ilog_CStreamLogCompBase_included
92
Basic implementation for logging using event queue for message transportation.
Basic implementation for a log written to an output stream.
void OnComponentDestroyed() override
void WriteMessageToLog(const MessagePtr &messagePtr) override
ilog::CLogCompBase BaseClass
bool IsMessageSupported(int messageCategory=-1, int messageId=-1, const QByteArray *senderIdPtr=nullptr) const override
Check if some messge is supported.
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 WriteText(const QString &text, istd::IInformationProvider::InformationCategory category)=0
Write a text line to the output stream.
std::shared_ptr< const istd::IInformationProvider > MessagePtr
Common interface for class providing some basic information object.
InformationCategory
Category of information.
This namespace contains implementations for the logging functionality.

© Witold Gantzke and Kirill Lepskiy