diff options
| author | 2017-02-09 04:36:04 -0500 | |
|---|---|---|
| committer | 2017-02-09 04:36:04 -0500 | |
| commit | d9aa870e5d509cc7309ab82dd102a937ab58613a (patch) | |
| tree | d92d03d76b5c390b335f1cfd761f1a0b59ec8496 /SQLiteStudio3/coreSQLiteStudio/log.cpp | |
| parent | 68ee4cbcbe424b95969c70346283a9f217f63825 (diff) | |
Imported Upstream version 3.1.1+dfsg1upstream/3.1.1+dfsg1
Diffstat (limited to 'SQLiteStudio3/coreSQLiteStudio/log.cpp')
| -rw-r--r-- | SQLiteStudio3/coreSQLiteStudio/log.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/SQLiteStudio3/coreSQLiteStudio/log.cpp b/SQLiteStudio3/coreSQLiteStudio/log.cpp index d45f1aa..60a22b2 100644 --- a/SQLiteStudio3/coreSQLiteStudio/log.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/log.cpp @@ -1,6 +1,7 @@ #include "log.h" #include "db/queryexecutorsteps/queryexecutorstep.h" #include <QTime> +#include <QDateTime> #include <QDebug> static bool SQL_DEBUG = false; @@ -17,6 +18,11 @@ void setSqlLoggingFilter(const QString& filter) SQL_DEBUG_FILTER = filter; } +QString getLogDateTime() +{ + return QDateTime::currentDateTime().toString("[HH:mm:ss.zzz]"); +} + void logSql(Db* db, const QString& str, const QHash<QString,QVariant>& args, Db::Flags flags) { if (!SQL_DEBUG) @@ -44,7 +50,7 @@ void logSql(Db* db, const QString& str, const QList<QVariant>& args, Db::Flags f qDebug() << QString("SQL %1> %2").arg(db->getName()).arg(str) << "(flags:" << Db::flagsToString(flags) << ")"; int i = 0; - foreach (const QVariant& arg, args) + for (const QVariant& arg : args) qDebug() << " SQL arg>" << i++ << "=" << arg; } @@ -58,7 +64,7 @@ void logExecutorStep(QueryExecutorStep* step) if (!EXECUTOR_DEBUG) return; - qDebug() << "Executing step:" << step->metaObject()->className() << step->objectName(); + qDebug() << getLogDateTime() << "Executing step:" << step->metaObject()->className() << step->objectName(); } @@ -67,5 +73,5 @@ void logExecutorAfterStep(const QString& str) if (!EXECUTOR_DEBUG) return; - qDebug() << str; + qDebug() << getLogDateTime() << str; } |
