NorMIT-nav
22.09
An IGT application
cxLogQDebugRedirecter.cpp
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
#include "
cxLogQDebugRedirecter.h
"
13
14
#include <QtGlobal>
15
#include "
cxReporter.h
"
16
17
namespace
cx
18
{
19
20
namespace
{
21
bool
isBogusQtWarning(QString msg)
22
{
23
// appears a lot on mac
24
// seems to be a bug in qt:
25
// http://stackoverflow.com/questions/33545006/qt5-attempt-to-set-a-screen-on-a-child-window-many-runtime-warning-messages
26
if
(msg.contains(
"QScreen("
) &&
27
msg.contains(
"): Attempt to set a screen on a child window."
))
28
return
true
;
29
return
false
;
30
}
31
}
32
33
void
convertQtMessagesToCxMessages
(QtMsgType type,
const
QMessageLogContext &,
const
QString &msg)
34
{
35
MESSAGE_LEVEL level;
// = mlINFO;
36
switch
(type)
37
{
38
#if (QT_VERSION >= QT_VERSION_CHECK(5, 5, 0))
39
case
QtInfoMsg:
40
level =
mlINFO
;
41
break
;
42
#endif
43
case
QtDebugMsg:
44
level =
mlDEBUG
;
45
break
;
46
case
QtWarningMsg:
47
if
(isBogusQtWarning(msg))
48
return
;
49
level =
mlWARNING
;
50
break
;
51
case
QtCriticalMsg:
52
level =
mlERROR
;
53
break
;
54
case
QtFatalMsg:
55
level =
mlERROR
;
56
//abort(); here we hope for the best instead of aborting...
57
default
:
58
level =
mlINFO
;
59
}
60
61
Message
message(
"[QT] "
+msg, level);
62
message.
mChannel
=
"qdebug"
;
63
reporter
()->sendMessage(message);
64
}
65
66
67
}
//End namespace cx
cxLogQDebugRedirecter.h
mlDEBUG
mlDEBUG
Definition:
cxDefinitions.h:70
cx::Message
Definition:
cxLogMessage.h:54
cx
Namespace for all CustusX production code.
Definition:
cx_dev_group_definitions.h:13
cx::Message::mChannel
QString mChannel
Definition:
cxLogMessage.h:74
cxReporter.h
cx::reporter
ReporterPtr reporter()
Definition:
cxReporter.cpp:36
mlERROR
mlERROR
Definition:
cxDefinitions.h:69
mlWARNING
mlWARNING
Definition:
cxDefinitions.h:68
cx::convertQtMessagesToCxMessages
void convertQtMessagesToCxMessages(QtMsgType type, const QMessageLogContext &, const QString &msg)
Definition:
cxLogQDebugRedirecter.cpp:33
mlINFO
mlINFO
Definition:
cxDefinitions.h:67
CX
source
resource
core
logger
internal
cxLogQDebugRedirecter.cpp
Generated on Tue Sep 13 2022 11:06:15 for NorMIT-nav by
1.8.17