CStreamLogCompBase.h
Go to the documentation of this file.
1 #ifndef ilog_CStreamLogCompBase_included
2 #define ilog_CStreamLogCompBase_included
3 
4 
5 // ACF includes
6 #include <ilog/CLogCompBase.h>
7 
8 
9 namespace ilog
10 {
11 
12 
19 {
20 public:
22 
23  I_BEGIN_BASE_COMPONENT(CStreamLogCompBase);
24  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);
25  I_ASSIGN(m_isDotEnabledAttrPtr, "ShowDots", "If it's true, dot will be shown for each ignored message", true, false);
26  I_ASSIGN(m_useCategoryAttrPtr, "UseCategory", "Use error category for the messsages (e.g warning or error)", true, true);
27  I_ASSIGN(m_useCodeAttrPtr, "UseCode", "Use error code for the messsages", true, true);
28  I_ASSIGN(m_useTimeStampAttrPtr, "UseTimeStamp", "Use time stamp for the messsages", true, false);
29  I_ASSIGN(m_timeFormatAttrPtr, "TimeFormat", "Format used for timestamp output", false, "dd.MM hh:mm:ss:zzz");
30  I_END_COMPONENT;
31 
33 
38 
39  // reimplemented (ilog::IMessageConsumer)
40  virtual bool IsMessageSupported(
41  int messageCategory = -1,
42  int messageId = -1,
43  const istd::IInformationProvider* messagePtr = NULL) const;
44 
45 protected:
49  virtual void WriteMessageToStream(const istd::IInformationProvider& message);
50 
54  virtual QString GenerateMessageText(const istd::IInformationProvider& message) const;
55 
56  // abstract methods
57 
61  virtual void WriteText(const QString& text, istd::IInformationProvider::InformationCategory category) = 0;
62 
63  // reimplemented (ilog::CLogCompBase)
64  virtual void WriteMessageToLog(const MessagePtr& messagePtr);
65 
66  // reimplemented (icomp::CComponentBase)
67  virtual void OnComponentDestroyed();
68 
69 private:
70  I_ATTR(int, m_minPriorityAttrPtr);
71  I_ATTR(bool, m_isDotEnabledAttrPtr);
72  I_ATTR(bool, m_useCategoryAttrPtr);
73  I_ATTR(bool, m_useCodeAttrPtr);
74  I_ATTR(bool, m_useTimeStampAttrPtr);
75  I_ATTR(QByteArray, m_timeFormatAttrPtr);
76 
77  bool m_isLastDotShown;
80 };
81 
82 
83 } // namespace ilog
84 
85 
86 #endif // !ilog_CStreamLogCompBase_included
87 
virtual void WriteText(const QString &text, istd::IInformationProvider::InformationCategory category)=0
Write a text line to the output stream.
virtual QString GenerateMessageText(const istd::IInformationProvider &message) const
Generate formatted message text for the output.
Basic implementation for logging using event queue for message transportation.
Definition: CLogCompBase.h:21
istd::IInformationProvider::InformationCategory GetWorseCategory() const
Get worse category (highest code) of all outputed messages.
virtual void WriteMessageToStream(const istd::IInformationProvider &message)
Write formatted message to the output stream.
virtual void OnComponentDestroyed()
virtual bool IsMessageSupported(int messageCategory=-1, int messageId=-1, const istd::IInformationProvider *messagePtr=NULL) const
Check if some messge is supported.
Implementation of a smart pointer.
Definition: TSmartPtr.h:24
Basic implementation for a log written to an output stream.
InformationCategory
Category of information.
#define NULL
Definition: istd.h:64
ilog::CLogCompBase BaseClass
Common interface for class providing some basic information object.
virtual void WriteMessageToLog(const MessagePtr &messagePtr)

© 2007-2017 Witold Gantzke and Kirill Lepskiy