CTK 0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
ctkErrorLogAbstractMessageHandler.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Library: CTK
4
5 Copyright (c) Kitware Inc.
6
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
10
11 http://www.apache.org/licenses/LICENSE-2.0.txt
12
13 Unless required by applicable law or agreed to in writing, software
14 distributed under the License is distributed on an "AS IS" BASIS,
15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 See the License for the specific language governing permissions and
17 limitations under the License.
18
19=========================================================================*/
20
21#ifndef CTKERRORLOGABSTRACTMESSAGEHANDLER_H
22#define CTKERRORLOGABSTRACTMESSAGEHANDLER_H
23
24// Qt includes
25#include <QObject>
26#include <QDateTime>
27
28// CTK includes
29#include "ctkCoreExport.h"
30#include "ctkErrorLogLevel.h"
32
33//------------------------------------------------------------------------------
34class ctkErrorLogAbstractMessageHandlerPrivate;
36
37//------------------------------------------------------------------------------
39class CTK_CORE_EXPORT ctkErrorLogAbstractMessageHandler : public QObject
40{
41 Q_OBJECT
42public:
43 typedef QObject Superclass;
47
48 virtual QString handlerName()const = 0;
49
50 QString handlerPrettyName()const;
51
52 bool enabled()const;
53 void setEnabled(bool value);
54
55 void handleMessage(const QString& threadId, ctkErrorLogLevel::LogLevel logLevel,
56 const QString& origin, const ctkErrorLogContext& logContext,
57 const QString &text);
58
61 ctkErrorLogTerminalOutput * terminalOutput);
62
63Q_SIGNALS:
64 void messageHandled(const QDateTime& currentDateTime, const QString& threadId,
65 ctkErrorLogLevel::LogLevel logLevel, const QString& origin,
66 const ctkErrorLogContext& logContext, const QString& text);
67
68protected:
69 void setHandlerPrettyName(const QString& newHandlerPrettyName);
70
71 virtual void setEnabledInternal(bool value) = 0;
72
73protected:
74 QScopedPointer<ctkErrorLogAbstractMessageHandlerPrivate> d_ptr;
75
76private:
77 Q_DECLARE_PRIVATE(ctkErrorLogAbstractMessageHandler)
79};
80
81
82#endif // CTKERRORLOGABSTRACTMESSAGEHANDLER_H
void setTerminalOutput(ctkErrorLogTerminalOutput::TerminalOutput terminalOutputType, ctkErrorLogTerminalOutput *terminalOutput)
void setHandlerPrettyName(const QString &newHandlerPrettyName)
void handleMessage(const QString &threadId, ctkErrorLogLevel::LogLevel logLevel, const QString &origin, const ctkErrorLogContext &logContext, const QString &text)
void messageHandled(const QDateTime &currentDateTime, const QString &threadId, ctkErrorLogLevel::LogLevel logLevel, const QString &origin, const ctkErrorLogContext &logContext, const QString &text)
virtual QString handlerName() const =0
virtual void setEnabledInternal(bool value)=0
QScopedPointer< ctkErrorLogAbstractMessageHandlerPrivate > d_ptr
ctkErrorLogAbstractMessageHandler()
Disabled by default.
ctkErrorLogTerminalOutput * terminalOutput(ctkErrorLogTerminalOutput::TerminalOutput terminalOutputType) const