diff options
author | Kai Koehne <kai.koehne@theqtcompany.com> | 2014-12-04 16:57:32 +0100 |
---|---|---|
committer | Kai Koehne <kai.koehne@theqtcompany.com> | 2015-01-09 13:14:05 +0100 |
commit | ef6279fd516befc09d4a6b3664a727a013b82c19 (patch) | |
tree | 4365a6dfb7c8d8e3094f35eb1ffe8fb8a23088cf /src/corelib/global/qlogging.h | |
parent | 4c980aedc17c1da8f7160989fbb845ea72b36f44 (diff) |
Add QtInfoMsg
Add an 'info' message type that can be used for messages that are neither
warnings (QtWarningMsg), nor for debugging only (QtDebugMsg). This is
useful mainly for applications that do not have to adhere to the
'do not print anything by default' paradigm that we have for
the Qt libraries itself.
[ChangeLog][QtCore][Logging] QtInfoMsg got added as a new QtMsgType.
Use the new qInfo(), qCInfo() macros to log to it.
Change-Id: I810995d63de46c41a9a99a34d37c0d417fa87a05
Reviewed-by: Jason McDonald <macadder1@gmail.com>
Diffstat (limited to 'src/corelib/global/qlogging.h')
-rw-r--r-- | src/corelib/global/qlogging.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/corelib/global/qlogging.h b/src/corelib/global/qlogging.h index f9bbf7fcce..829cd7c885 100644 --- a/src/corelib/global/qlogging.h +++ b/src/corelib/global/qlogging.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtCore module of the Qt Toolkit. @@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE class QDebug; class QNoDebug; -enum QtMsgType { QtDebugMsg, QtWarningMsg, QtCriticalMsg, QtFatalMsg, QtSystemMsg = QtCriticalMsg }; +enum QtMsgType { QtDebugMsg, QtWarningMsg, QtCriticalMsg, QtFatalMsg, QtInfoMsg, QtSystemMsg = QtCriticalMsg }; class QMessageLogContext { @@ -89,6 +89,7 @@ public: void debug(const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(2, 3); void noDebug(const char *, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(2, 3) {} + void info(const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(2, 3); void warning(const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(2, 3); void critical(const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(2, 3); @@ -96,6 +97,8 @@ public: void debug(const QLoggingCategory &cat, const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(3, 4); void debug(CategoryFunction catFunc, const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(3, 4); + void info(const QLoggingCategory &cat, const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(3, 4); + void info(CategoryFunction catFunc, const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(3, 4); void warning(const QLoggingCategory &cat, const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(3, 4); void warning(CategoryFunction catFunc, const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(3, 4); void critical(const QLoggingCategory &cat, const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(3, 4); @@ -110,6 +113,9 @@ public: QDebug debug() const; QDebug debug(const QLoggingCategory &cat) const; QDebug debug(CategoryFunction catFunc) const; + QDebug info() const; + QDebug info(const QLoggingCategory &cat) const; + QDebug info(CategoryFunction catFunc) const; QDebug warning() const; QDebug warning(const QLoggingCategory &cat) const; QDebug warning(CategoryFunction catFunc) const; @@ -143,6 +149,7 @@ private: #endif #define qDebug QMessageLogger(QT_MESSAGELOG_FILE, QT_MESSAGELOG_LINE, QT_MESSAGELOG_FUNC).debug +#define qInfo QMessageLogger(QT_MESSAGELOG_FILE, QT_MESSAGELOG_LINE, QT_MESSAGELOG_FUNC).info #define qWarning QMessageLogger(QT_MESSAGELOG_FILE, QT_MESSAGELOG_LINE, QT_MESSAGELOG_FUNC).warning #define qCritical QMessageLogger(QT_MESSAGELOG_FILE, QT_MESSAGELOG_LINE, QT_MESSAGELOG_FUNC).critical #define qFatal QMessageLogger(QT_MESSAGELOG_FILE, QT_MESSAGELOG_LINE, QT_MESSAGELOG_FUNC).fatal @@ -154,6 +161,10 @@ private: # undef qDebug # define qDebug QT_NO_QDEBUG_MACRO #endif +#if defined(QT_NO_INFO_OUTPUT) +# undef qInfo +# define qInfo QT_NO_QDEBUG_MACRO +#endif #if defined(QT_NO_WARNING_OUTPUT) # undef qWarning # define qWarning QT_NO_QWARNING_MACRO |