summaryrefslogtreecommitdiffstats
path: root/src/corelib/doc/snippets/qloggingcategory/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/doc/snippets/qloggingcategory/main.cpp')
-rw-r--r--src/corelib/doc/snippets/qloggingcategory/main.cpp27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/corelib/doc/snippets/qloggingcategory/main.cpp b/src/corelib/doc/snippets/qloggingcategory/main.cpp
index 3c6424921e..8d76c5736e 100644
--- a/src/corelib/doc/snippets/qloggingcategory/main.cpp
+++ b/src/corelib/doc/snippets/qloggingcategory/main.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
@@ -59,10 +59,11 @@ struct UsbEntry {
int classtype;
};
-QDebug operator<<(QDebug &dbg, const UsbEntry &entry)
+QDebug operator<<(QDebug &debug, const UsbEntry &entry)
{
- dbg.nospace() << "" << entry.id << " (" << entry.classtype << ")";
- return dbg.space();
+ QDebugStateSaver saver(debug);
+ debug.nospace() << "" << entry.id << " (" << entry.classtype << ')';
+ return debug;
}
QList<UsbEntry> usbEntries() {
@@ -117,6 +118,11 @@ oldCategoryFilter = QLoggingCategory::installFilter(myCategoryFilter);
//![10]
}
+//![qcinfo_stream]
+ QLoggingCategory category("driver.usb");
+ qCInfo(category) << "an informational message";
+//![qcinfo_stream]
+
{
//![11]
QLoggingCategory category("driver.usb");
@@ -139,6 +145,13 @@ oldCategoryFilter = QLoggingCategory::installFilter(myCategoryFilter);
}
{
+//![qcinfo_printf]
+ QLoggingCategory category("driver.usb");
+ qCInfo(category, "an informational message logged into category %s", category.categoryName());
+//![qcinfo_printf]
+ }
+
+ {
//![14]
QLoggingCategory category("driver.usb");
qCWarning(category, "a warning message logged into category %s", category.categoryName());