summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Ehrlicher <ch.ehrlicher@gmx.de>2024-03-15 20:32:02 +0100
committerChristian Ehrlicher <ch.ehrlicher@gmx.de>2024-04-04 22:43:01 +0100
commit1dd3f465707dd3bee2b72c5f75f13984522eee44 (patch)
tree78415b06fff54098dc02ee586c98716e6de6ad85
parentd99d355e4913eed78f7db3c78b19b9af4da02043 (diff)
SQL/SQLite: use categorized logger
Use the categorized logger qt.sql.sqlite Change-Id: I70880fca579df56500ddc94a72bc6c616c475e67 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
-rw-r--r--src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp b/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp
index 469afcac83..c574772fd7 100644
--- a/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp
+++ b/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp
@@ -7,6 +7,7 @@
#include <qdatetime.h>
#include <qdebug.h>
#include <qlist.h>
+#include <qloggingcategory.h>
#include <qsqlerror.h>
#include <qsqlfield.h>
#include <qsqlindex.h>
@@ -38,6 +39,8 @@ Q_DECLARE_METATYPE(sqlite3_stmt*)
QT_BEGIN_NAMESPACE
+static Q_LOGGING_CATEGORY(lcSqlite, "qt.sql.sqlite")
+
using namespace Qt::StringLiterals;
static int qGetColumnType(const QString &tpName)
@@ -803,7 +806,7 @@ bool QSQLiteDriver::open(const QString & db, const QString &, const QString &, c
}
#endif
else
- qWarning("Unsupported option '%ls'", qUtf16Printable(option.toString()));
+ qCWarning(lcSqlite, "Unsupported option '%ls'", qUtf16Printable(option.toString()));
}
int openMode = (openReadOnlyOption ? SQLITE_OPEN_READONLY : (SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE));
@@ -814,7 +817,7 @@ bool QSQLiteDriver::open(const QString & db, const QString &, const QString &, c
#if defined(SQLITE_OPEN_NOFOLLOW)
openMode |= SQLITE_OPEN_NOFOLLOW;
#else
- qWarning("SQLITE_OPEN_NOFOLLOW not supported with the SQLite version %s", sqlite3_libversion());
+ qCWarning(lcSqlite, "SQLITE_OPEN_NOFOLLOW not supported with the SQLite version %s", sqlite3_libversion());
#endif
}
@@ -1055,12 +1058,13 @@ bool QSQLiteDriver::subscribeToNotification(const QString &name)
{
Q_D(QSQLiteDriver);
if (!isOpen()) {
- qWarning("Database not open.");
+ qCWarning(lcSqlite, "QSQLiteDriver::subscribeToNotification: Database not open.");
return false;
}
if (d->notificationid.contains(name)) {
- qWarning("Already subscribing to '%ls'.", qUtf16Printable(name));
+ qCWarning(lcSqlite, "QSQLiteDriver::subscribeToNotification: Already subscribing to '%ls'.",
+ qUtf16Printable(name));
return false;
}
@@ -1076,12 +1080,13 @@ bool QSQLiteDriver::unsubscribeFromNotification(const QString &name)
{
Q_D(QSQLiteDriver);
if (!isOpen()) {
- qWarning("Database not open.");
+ qCWarning(lcSqlite, "QSQLiteDriver::unsubscribeFromNotification: Database not open.");
return false;
}
if (!d->notificationid.contains(name)) {
- qWarning("Not subscribed to '%ls'.", qUtf16Printable(name));
+ qCWarning(lcSqlite, "QSQLiteDriver::unsubscribeFromNotification: Not subscribed to '%ls'.",
+ qUtf16Printable(name));
return false;
}