summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qloggingcategory.cpp
diff options
context:
space:
mode:
authorKai Köhne <kai.koehne@qt.io>2022-12-05 12:10:09 +0100
committerKai Köhne <kai.koehne@qt.io>2022-12-05 19:02:59 +0100
commitade429af3308e6254f46caf513925f00af42d6c2 (patch)
treec6f038d033eac90c16c01bf8f594c87c0e07c69f /src/corelib/io/qloggingcategory.cpp
parentf5f5a29bbac86d31420be8058d4b96b210d8560e (diff)
Doc: Add documentation for qCFatal()
Change-Id: Iad9ea51285300eb06fdd7e68dd747702cb0a80e5 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Diffstat (limited to 'src/corelib/io/qloggingcategory.cpp')
-rw-r--r--src/corelib/io/qloggingcategory.cpp49
1 files changed, 45 insertions, 4 deletions
diff --git a/src/corelib/io/qloggingcategory.cpp b/src/corelib/io/qloggingcategory.cpp
index 6f3fa61359..e98a12ac46 100644
--- a/src/corelib/io/qloggingcategory.cpp
+++ b/src/corelib/io/qloggingcategory.cpp
@@ -20,7 +20,8 @@ Q_GLOBAL_STATIC(QLoggingCategory, qtDefaultCategory, qtDefaultCategoryName)
QLoggingCategory represents a certain logging category - identified by a
string - at runtime. A category can be configured to enable or disable
- logging of messages per message type.
+ logging of messages per message type. An exception are fatal messages,
+ which are always enabled.
To check whether a message type is enabled or not, use one of these methods:
\l isDebugEnabled(), \l isInfoEnabled(), \l isWarningEnabled(), and
@@ -79,7 +80,7 @@ Q_GLOBAL_STATIC(QLoggingCategory, qtDefaultCategory, qtDefaultCategoryName)
If no argument is passed, all messages are logged. Only Qt internal categories
which start with \c{qt} are handled differently: For these, only messages of type
- \c QtInfoMsg, \c QtWarningMsg, and \c QtCriticalMsg are logged by default.
+ \c QtInfoMsg, \c QtWarningMsg, \c QtCriticalMsg, and \c QFatalMsg are logged by default.
\note Logging categories are not affected by your C++ build configuration.
That is, whether messages are printed does not change depending on whether
@@ -292,7 +293,7 @@ void QLoggingCategory::setEnabled(QtMsgType type, bool enable)
Returns the object itself. This allows for both: a QLoggingCategory variable, and
a factory method that returns a QLoggingCategory, to be used in \l qCDebug(),
- \l qCWarning(), or \l qCCritical() macros.
+ \l qCWarning(), \l qCCritical(), or \l qCFatal() macros.
*/
/*!
@@ -300,7 +301,7 @@ void QLoggingCategory::setEnabled(QtMsgType type, bool enable)
Returns the object itself. This allows for both: a QLoggingCategory variable, and
a factory method that returns a QLoggingCategory, to be used in \l qCDebug(),
- \l qCWarning(), or \l qCCritical() macros.
+ \l qCWarning(), \l qCCritical(), or \l qCFatal() macros.
*/
/*!
@@ -556,6 +557,46 @@ void QLoggingCategory::setFilterRules(const QString &rules)
\sa qCritical()
*/
+
+/*!
+ \macro qCFatal(category)
+ \relates QLoggingCategory
+ \since 6.5
+
+ Returns an output stream for fatal messages in the logging category,
+ \a category.
+
+ If you are using the \b{default message handler}, the returned stream will abort
+ to create a core dump. On Windows, for debug builds, this function will
+ report a \c _CRT_ERROR enabling you to connect a debugger to the application.
+
+ Example:
+
+ \snippet qloggingcategory/main.cpp 16
+
+ \sa qFatal()
+*/
+
+/*!
+ \macro qCFatal(category, const char *message, ...)
+ \relates QLoggingCategory
+ \since 6.5
+
+ Logs a fatal message, \a message, in the logging category, \a category.
+ \a message may contain place holders to be replaced by additional arguments,
+ similar to the C printf() function.
+
+ Example:
+
+ \snippet qloggingcategory/main.cpp 17
+
+ If you are using the \b{default message handler}, this function will abort
+ to create a core dump. On Windows, for debug builds, this function will
+ report a \c _CRT_ERROR enabling you to connect a debugger to the application.
+
+ \sa qFatal()
+*/
+
/*!
\macro Q_DECLARE_LOGGING_CATEGORY(name)
\sa Q_LOGGING_CATEGORY(), Q_DECLARE_EXPORTED_LOGGING_CATEGORY()