diff --git a/src/kleopatraapplication.cpp b/src/kleopatraapplication.cpp --- a/src/kleopatraapplication.cpp +++ b/src/kleopatraapplication.cpp @@ -188,6 +188,9 @@ if (logAll || options.contains("io")) { log->setIOLoggingEnabled(true); } + if (options.contains("timestamp")) { + log->setTimestampEnabled(true); + } qInstallMessageHandler(Log::messageHandler); #ifdef HAVE_USABLE_ASSUAN diff --git a/src/utils/log.h b/src/utils/log.h --- a/src/utils/log.h +++ b/src/utils/log.h @@ -65,6 +65,9 @@ bool ioLoggingEnabled() const; void setIOLoggingEnabled(bool enabled); + bool isTimestampEnabled() const; + void setTimestampEnabled(bool enabled); + QString outputDirectory() const; void setOutputDirectory(const QString &path); diff --git a/src/utils/log.cpp b/src/utils/log.cpp --- a/src/utils/log.cpp +++ b/src/utils/log.cpp @@ -69,9 +69,8 @@ void Log::messageHandler(QtMsgType type, const QMessageLogContext &ctx, const QString& msg) { - Q_UNUSED(type) - Q_UNUSED(ctx) - const QByteArray local8str = msg.toLocal8Bit(); + const QString formattedMessage = qFormatLogMessage(type, ctx, msg); + const QByteArray local8str = formattedMessage.toLocal8Bit(); FILE *const file = Log::instance()->logFile(); if (!file) { fprintf(stderr, "Log::messageHandler[!file]: %s", local8str.constData());