summaryrefslogtreecommitdiffstats
path: root/src/corelib/global/qglobal.h
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@nokia.com>2012-01-17 16:20:45 +0100
committerQt by Nokia <qt-info@nokia.com>2012-02-01 02:16:32 +0100
commitd394ca7f27197cfbfc28eb9a08eb0db261dd9d3d (patch)
treee75e133531101682473f91f5feca6c88c3e38c6c /src/corelib/global/qglobal.h
parentea783ff51f25af89b7219154d7be5de1fd138664 (diff)
QtDebug: Include file, line, function information
Record the file, line, and function where a qDebug, qWarning, qCritical or qFatal call happens, and make this information available in a custom message handler. The patch uses the C preprocessor to replace qDebug, qWarning, ... with a line that also records the current file, line, and function. Custom message handlers can access this information via a new QMessageLogContext argument. Change-Id: I0a9b89c1d137e41775932d3b1a35da4ebf12d18d Reviewed-by: David Faure <faure@kde.org>
Diffstat (limited to 'src/corelib/global/qglobal.h')
-rw-r--r--src/corelib/global/qglobal.h62
1 files changed, 3 insertions, 59 deletions
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 2e6f6c32a8..681cd55bb0 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -1637,65 +1637,12 @@ inline void qUnused(T &x) { (void)x; }
# define qPrintable(string) QString(string).toLocal8Bit().constData()
#endif
-Q_CORE_EXPORT void qDebug(const char *, ...) /* print debug message */
-#if defined(Q_CC_GNU) && !defined(__INSURE__)
- __attribute__ ((format (printf, 1, 2)))
-#endif
-;
-
-Q_CORE_EXPORT void qWarning(const char *, ...) /* print warning message */
-#if defined(Q_CC_GNU) && !defined(__INSURE__)
- __attribute__ ((format (printf, 1, 2)))
-#endif
-;
-
class QString;
Q_CORE_EXPORT QString qt_error_string(int errorCode = -1);
-Q_CORE_EXPORT void qCritical(const char *, ...) /* print critical message */
-#if defined(Q_CC_GNU) && !defined(__INSURE__)
- __attribute__ ((format (printf, 1, 2)))
-#endif
-;
-Q_CORE_EXPORT void qFatal(const char *, ...) /* print fatal message and exit */
-#if defined(Q_CC_GNU) && !defined(__INSURE__)
- __attribute__ ((format (printf, 1, 2)))
-#endif
-;
Q_CORE_EXPORT void qErrnoWarning(int code, const char *msg, ...);
Q_CORE_EXPORT void qErrnoWarning(const char *msg, ...);
-/*
- Forward declarations only.
-
- In order to use the qDebug() stream, you must #include<QDebug>
-*/
-class QDebug;
-class QNoDebug;
-#if !defined(QT_NO_DEBUG_OUTPUT) && !defined(QT_NO_DEBUG_STREAM)
-Q_CORE_EXPORT_INLINE QDebug qDebug();
-#else
-inline QNoDebug qDebug();
-#endif
-#if !defined(QT_NO_WARNING_OUTPUT) && !defined(QT_NO_DEBUG_STREAM)
-Q_CORE_EXPORT_INLINE QDebug qWarning();
-#else
-inline QNoDebug qWarning();
-#endif
-#if !defined(QT_NO_DEBUG_STREAM)
-Q_CORE_EXPORT_INLINE QDebug qCritical();
-#endif
-
-#define QT_NO_QDEBUG_MACRO while (false) qDebug
-#ifdef QT_NO_DEBUG_OUTPUT
-# define qDebug QT_NO_QDEBUG_MACRO
-#endif
-#define QT_NO_QWARNING_MACRO while (false) qWarning
-#ifdef QT_NO_WARNING_OUTPUT
-# define qWarning QT_NO_QWARNING_MACRO
-#endif
-
-
Q_CORE_EXPORT void qt_assert(const char *assertion, const char *file, int line);
#if !defined(Q_ASSERT)
@@ -1774,12 +1721,6 @@ inline T *q_check_ptr(T *p) { Q_CHECK_PTR(p); return p; }
# endif
#endif
-enum QtMsgType { QtDebugMsg, QtWarningMsg, QtCriticalMsg, QtFatalMsg, QtSystemMsg = QtCriticalMsg };
-
-Q_CORE_EXPORT void qt_message_output(QtMsgType, const char *buf);
-
-typedef void (*QtMsgHandler)(QtMsgType, const char *);
-Q_CORE_EXPORT QtMsgHandler qInstallMsgHandler(QtMsgHandler);
typedef void (*QFunctionPointer)();
@@ -2499,6 +2440,9 @@ template <typename T> struct QEnableIf<true, T> { typedef T Type; };
QT_END_NAMESPACE
QT_END_HEADER
+// qDebug and friends
+#include "qlogging.h"
+
#endif /* __cplusplus */
#endif /* QGLOBAL_H */