diff options
author | Bernd Weimer <bernd.weimer@pelagicore.com> | 2019-03-22 13:00:50 +0100 |
---|---|---|
committer | Bernd Weimer <bernd.weimer@pelagicore.com> | 2019-10-11 21:44:44 +0200 |
commit | 689905b4b45349ba9f376d4814851afba4a34165 (patch) | |
tree | c75bbac78bf3a9a69d469e5f11a4aa58a6046fb5 | |
parent | d835bb2e738c658cda134d85c1eff8a54cfc279d (diff) |
Fix file name logging output
Plain source file names (without path) were not printed.
Cherry-picked from dev: 8136774
Change-Id: I6330ad851cb35c7bc83356e6d5757bf11f5eb450
Reviewed-by: Robert Griebl <robert.griebl@qt.io>
-rw-r--r-- | src/common-lib/logging.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/common-lib/logging.cpp b/src/common-lib/logging.cpp index 24cc003d..f9356cea 100644 --- a/src/common-lib/logging.cpp +++ b/src/common-lib/logging.cpp @@ -157,15 +157,14 @@ static void colorLogToStderr(QtMsgType msgType, const QMessageLogContext &contex #endif if (pos < 0) pos = ba.lastIndexOf('/'); - if (pos >= 0) { - filename = context.file + pos + 1; - filenameLength = ba.size() - pos - 1; - - linenumberLength = qsnprintf(linenumber, 8, "%d", qMin(context.line, 9999999)); - if (linenumberLength < 0 || linenumberLength >= int(sizeof(linenumber))) - linenumberLength = 0; - linenumber[linenumberLength] = 0; - } + + filename = context.file + pos + 1; + filenameLength = ba.size() - pos - 1; + + linenumberLength = qsnprintf(linenumber, 8, "%d", qMin(context.line, 9999999)); + if (linenumberLength < 0 || linenumberLength >= int(sizeof(linenumber))) + linenumberLength = 0; + linenumber[linenumberLength] = 0; } enum ConsoleColor { Off = 0, Black, Red, Green, Yellow, Blue, Magenta, Cyan, Gray, BrightFlag = 0x80 }; |