From 486d4684b8136d65a9cd88707063711f83f4407f Mon Sep 17 00:00:00 2001 From: Pedro Pombeiro Date: Fri, 14 Sep 2018 17:30:31 +0200 Subject: [PATCH] Improve log format in StatusIm and add timestamps Signed-off-by: Pedro Pombeiro --- desktop/main.cpp | 16 ++++++++++------ scripts/merge-pr.sh | 1 + 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/desktop/main.cpp b/desktop/main.cpp index 8aad51eb8b..2a36425ded 100644 --- a/desktop/main.cpp +++ b/desktop/main.cpp @@ -325,23 +325,27 @@ void saveMessage(QtMsgType type, const QMessageLogContext &context, QByteArray localMsg = msg.toLocal8Bit(); QString message = localMsg + "\n"; + QString timestamp = QDateTime::currentDateTime().toString("hh:mm:ss.zzz"); + QString typeStr; switch (type) { case QtDebugMsg: - appendConsoleString(QString("Debug: %1 \n").arg(message)); + typeStr = "D"; break; case QtInfoMsg: - appendConsoleString(QString("Info: %1 \n").arg(message)); + typeStr = "I"; break; case QtWarningMsg: - appendConsoleString(QString("Warning: %1 \n").arg(message)); + typeStr = "W"; break; case QtCriticalMsg: - appendConsoleString(QString("Critical: %1 \n").arg(message)); + typeStr = "C"; break; case QtFatalMsg: - - appendConsoleString(QString("Fatal: %1 \n").arg(message)); + typeStr = "F"; + } + appendConsoleString(QString("%1 - %2 - %3").arg(timestamp, typeStr, message)); + if (type == QtFatalMsg) { writeLogsToFile(); abort(); } diff --git a/scripts/merge-pr.sh b/scripts/merge-pr.sh index b80795a9c3..64788f8a75 100755 --- a/scripts/merge-pr.sh +++ b/scripts/merge-pr.sh @@ -46,6 +46,7 @@ check_sync() { read response; if [ "$response" = "reset" ]; then git fetch $REMOTE + git checkout $BRANCH git reset --hard $REMOTE/$BRANCH else fatal "the local branch $BRANCH is behind $REMOTE/$BRANCH."