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 //------------------------------------------------------------------------------
34 class ctkErrorLogAbstractMessageHandlerPrivate;
35 struct ctkErrorLogContext;
36 
37 //------------------------------------------------------------------------------
39 class CTK_CORE_EXPORT ctkErrorLogAbstractMessageHandler : public QObject
40 {
41  Q_OBJECT
42 public:
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 
63 Q_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 
68 protected:
69  void setHandlerPrettyName(const QString& newHandlerPrettyName);
70 
71  virtual void setEnabledInternal(bool value) = 0;
72 
73 protected:
74  QScopedPointer<ctkErrorLogAbstractMessageHandlerPrivate> d_ptr;
75 
76 private:
77  Q_DECLARE_PRIVATE(ctkErrorLogAbstractMessageHandler)
78  Q_DISABLE_COPY(ctkErrorLogAbstractMessageHandler)
79 };
80 
81 
82 #endif // CTKERRORLOGABSTRACTMESSAGEHANDLER_H
ctkErrorLogTerminalOutput::TerminalOutput
TerminalOutput
Definition: ctkErrorLogTerminalOutput.h:46
ctkErrorLogAbstractMessageHandler::handleMessage
void handleMessage(const QString &threadId, ctkErrorLogLevel::LogLevel logLevel, const QString &origin, const ctkErrorLogContext &logContext, const QString &text)
ctkErrorLogAbstractMessageHandler::terminalOutput
ctkErrorLogTerminalOutput * terminalOutput(ctkErrorLogTerminalOutput::TerminalOutput terminalOutputType) const
ctkErrorLogAbstractMessageHandler::handlerName
virtual QString handlerName() const =0
ctkErrorLogAbstractMessageHandler::setHandlerPrettyName
void setHandlerPrettyName(const QString &newHandlerPrettyName)
ctkErrorLogLevel::LogLevel
LogLevel
Definition: ctkErrorLogLevel.h:40
ctkErrorLogAbstractMessageHandler::enabled
bool enabled() const
ctkErrorLogAbstractMessageHandler::messageHandled
void messageHandled(const QDateTime &currentDateTime, const QString &threadId, ctkErrorLogLevel::LogLevel logLevel, const QString &origin, const ctkErrorLogContext &logContext, const QString &text)
ctkErrorLogAbstractMessageHandler
Definition: ctkErrorLogAbstractMessageHandler.h:40
ctkErrorLogAbstractMessageHandler::~ctkErrorLogAbstractMessageHandler
virtual ~ctkErrorLogAbstractMessageHandler()
ctkErrorLogAbstractMessageHandler::handlerPrettyName
QString handlerPrettyName() const
ctkErrorLogAbstractMessageHandler::ctkErrorLogAbstractMessageHandler
ctkErrorLogAbstractMessageHandler()
Disabled by default.
ctkErrorLogLevel.h
ctkErrorLogAbstractMessageHandler::setEnabled
void setEnabled(bool value)
ctkErrorLogTerminalOutput
Definition: ctkErrorLogTerminalOutput.h:37
ctkErrorLogContext
Definition: ctkErrorLogContext.h:33
ctkErrorLogAbstractMessageHandler::d_ptr
QScopedPointer< ctkErrorLogAbstractMessageHandlerPrivate > d_ptr
Definition: ctkErrorLogAbstractMessageHandler.h:74
ctkErrorLogAbstractMessageHandler::setTerminalOutput
void setTerminalOutput(ctkErrorLogTerminalOutput::TerminalOutput terminalOutputType, ctkErrorLogTerminalOutput *terminalOutput)
ctkErrorLogAbstractMessageHandler::Superclass
QObject Superclass
Definition: ctkErrorLogAbstractMessageHandler.h:43
ctkErrorLogTerminalOutput.h
ctkErrorLogAbstractMessageHandler::setEnabledInternal
virtual void setEnabledInternal(bool value)=0