summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2014-11-19 14:14:36 -0800
committerJani Heikkinen <jani.heikkinen@theqtcompany.com>2014-11-21 16:47:35 +0100
commitbb07737614d3fdf867e8e5da835554ae731ba04f (patch)
tree7b5fe961485539c37690f259a7a28fdb7ee33880 /src
parent0792943d59eaa41f5e04b6ccaf39322eb8657f2a (diff)
Fix the %{time} printing to *not* default to the process's time
The default should be the actual time of day. Showing the process's time is the optional case. In the future, we'll provide a way to showing the monotonic reference time ("boot") and we should improve the detection of actual application runtime. Change-Id: I41936d77ab9fad2073dc0ce1c97cabe57ec39f16 Reviewed-by: Jan Arve Sæther <jan-arve.saether@theqtcompany.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/global/qlogging.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp
index 39c5ac602e..843ec6b0ca 100644
--- a/src/corelib/global/qlogging.cpp
+++ b/src/corelib/global/qlogging.cpp
@@ -1201,11 +1201,14 @@ QString qFormatLogMessage(QtMsgType type, const QMessageLogContext &context, con
}
#endif
} else if (token == timeTokenC) {
- quint64 ms = pattern->timer.elapsed();
- if (pattern->timeFormat.isEmpty())
+ if (pattern->timeFormat == QLatin1String("process")) {
+ quint64 ms = pattern->timer.elapsed();
message.append(QString().sprintf("%6d.%03d", uint(ms / 1000), uint(ms % 1000)));
- else
- message.append(pattern->startTime.addMSecs(ms).toString(pattern->timeFormat));
+ } else if (pattern->timeFormat.isEmpty()) {
+ message.append(QDateTime::currentDateTime().toString(Qt::ISODate));
+ } else {
+ message.append(QDateTime::currentDateTime().toString(pattern->timeFormat));
+ }
#endif
} else if (token == ifCategoryTokenC) {
if (!context.category || (strcmp(context.category, "default") == 0))
@@ -1550,9 +1553,10 @@ void qErrnoWarning(int code, const char *msg, ...)
\row \li \c %{pid} \li QCoreApplication::applicationPid()
\row \li \c %{threadid} \li ID of current thread
\row \li \c %{type} \li "debug", "warning", "critical" or "fatal"
- \row \li \c %{time} \li time of the message, in seconds since the process started
- \row \li \c %{time format} \li system time when the message occurred, formatted by
- passing the \c format to \l QDateTime::toString()
+ \row \li \c %{time process} \li time of the message, in seconds since the process started (the token "process" is literal)
+ \row \li \c %{time [format]} \li system time when the message occurred, formatted by
+ passing the \c format to \l QDateTime::toString(). If the format is
+ not specified, the format of Qt::ISODate is used.
\row \li \c{%{backtrace [depth=N] [separator="..."]}} \li A backtrace with the number of frames
specified by the optional \c depth parameter (defaults to 5), and separated by the optional
\c separator parameter (defaults to "|").