summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qloggingcategory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/io/qloggingcategory.cpp')
-rw-r--r--src/corelib/io/qloggingcategory.cpp54
1 files changed, 47 insertions, 7 deletions
diff --git a/src/corelib/io/qloggingcategory.cpp b/src/corelib/io/qloggingcategory.cpp
index bdae7e7f50..10763dd65a 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()
@@ -585,7 +626,7 @@ void QLoggingCategory::setFilterRules(const QString &rules)
For example:
\code
- Q_DECLARE_EXPORTED_LOGGING_CATEGORY("lib.core", LIB_EXPORT_MACRO)
+ Q_DECLARE_EXPORTED_LOGGING_CATEGORY(lcCore, LIB_EXPORT_MACRO)
\endcode
This macro must be used outside of a class or function.
@@ -621,8 +662,7 @@ void QLoggingCategory::setFilterRules(const QString &rules)
with a specific name. The implicitly-defined QLoggingCategory object is
created on first use, in a thread-safe manner.
- This macro must be used outside of a class or method. It is only defined
- if variadic macros are supported.
+ This macro must be used outside of a class or method.
*/
QT_END_NAMESPACE