31 #include "miscellaneous/debugging.h"
33 #include "definitions/definitions.h"
34 #include "miscellaneous/application.h"
41 #ifndef QT_NO_DEBUG_OUTPUT
42 #if QT_VERSION >= 0x050000
43 #define DEBUG_OUTPUT_WORKER(type_string, file, line, message) \
44 fprintf(stderr, "[%s] %s (%s:%d): %s\n", \
51 #define DEBUG_OUTPUT_WORKER(type_string, message) \
52 fprintf(stderr, "[%s] %s: %s\n", \
60 #if QT_VERSION >= 0x050000
61 void Debugging::debugHandler(QtMsgType type,
62 const QMessageLogContext &placement,
63 const QString &message) {
64 #ifndef QT_NO_DEBUG_OUTPUT
65 const char *file = qPrintable(QString(placement.file).section(QDir::separator(),
70 DEBUG_OUTPUT_WORKER(
"INFO", file, placement.line, message);
73 DEBUG_OUTPUT_WORKER(
"WARNING", file, placement.line, message);
76 DEBUG_OUTPUT_WORKER(
"CRITICAL", file, placement.line, message);
79 DEBUG_OUTPUT_WORKER(
"FATAL", file, placement.line, message);
80 qApp->exit(EXIT_FAILURE);
91 void Debugging::debugHandler(QtMsgType type,
const char *message) {
92 #ifndef QT_NO_DEBUG_OUTPUT
95 DEBUG_OUTPUT_WORKER(
"INFO", message);
98 DEBUG_OUTPUT_WORKER(
"WARNING", message);
101 DEBUG_OUTPUT_WORKER(
"CRITICAL", message);
104 DEBUG_OUTPUT_WORKER(
"FATAL", message);
105 qApp->exit(EXIT_FAILURE);
116 Debugging::Debugging() {