Fraxinus  18.10
An IGT application
cxReporterThread.h
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 
12 #ifndef CXREPORTERTHREAD_H
13 #define CXREPORTERTHREAD_H
14 
15 #include "cxResourceExport.h"
16 
17 //#define SSC_PRINT_CALLER_INFO
18 
19 #include <QMetaType>
20 #include <QObject>
21 #include <QMutex>
22 #include <QDateTime>
23 #include <QFile>
24 #include "boost/shared_ptr.hpp"
25 #include "boost/function.hpp"
26 #include "cxDefinitions.h"
27 #include "cxAudio.h"
28 #include <sstream>
29 #include "cxTypeConversions.h"
30 #include "cxLogger.h"
31 #include "cxLogMessage.h"
32 #include <QList>
33 #include <QThread>
34 #include "cxLogThread.h"
35 
36 class QString;
37 class QDomNode;
38 class QDomDocument;
39 class QFile;
40 class QTextStream;
41 
48 namespace cx
49 {
50 
55 class ReporterThread : public LogThread
56 {
57  Q_OBJECT
58 
59 public:
60  ReporterThread(QObject* parent = NULL);
61  virtual ~ReporterThread();
62 
63 public slots:
64  virtual void logMessage(Message msg);
65 
66 signals:
67  void emittedMessage(Message message);
68 
69 protected:
70  virtual void executeSetLoggingFolder(QString absoluteLoggingFolderPath);
71 
72 private slots:
73  void onMessageEmitted(Message msg);
74 private:
75  bool initializeLogFile(LogFile file);
76 
77  void sendToFile(Message message);
78  void sendToCout(Message message);
79 
80  typedef boost::shared_ptr<class SingleStreamerImpl> SingleStreamerImplPtr;
81  SingleStreamerImplPtr mCout;
82  SingleStreamerImplPtr mCerr;
83 
84  QString mLogPath;
85  QStringList mInitializedFiles;
86 
87 };
88 
89 } //namespace cx
90 
95 #endif // CXREPORTERTHREAD_H
virtual void logMessage(Message msg)
virtual void executeSetLoggingFolder(QString absoluteLoggingFolderPath)
void emittedMessage(Message message)
emitted for each new message, in addition to writing to file.
ReporterThread(QObject *parent=NULL)
Namespace for all CustusX production code.