k***@nokia.com
13 years ago
Hi there,
In Qt 4 qDebug, qWarning etc just printed whatever was passed in. In Qt 5 we've been changing this (1) so that you can configure Qt to print additional information by setting the QT_MESSAGE_PATTERN environment variable. However, we didn't change the default so far - so without setting QT_MESSAGE_PATTERN we still just print the message. I just had a discussion (2) with Thiago Macieira and David Faure where we agreed that we'd like to still change this for Qt 5.0 ...
My personal motivation is that if e.g. the type would be always part of the message Qt Creator could use this information to colorize/filter output. Adding the app name / PID would identify the app in case of system logs, adding the function would give you a clue where on earth you added this one debug statement just printing "true" ;) So, what do you think about changing the default format to e.g.
"[%{type}] %{appname}(%{pid}) %{function} %{message}"
Example output:
[warning] QtCreator(16693) QtSupport::BaseQtVersion::qtVersionString - Cannot determine the Qt version: /home/kkoehne/dev/qt/test/bin/qmake cannot be run.
or
[warning] QtQmlViewer(16790) unknown - file:///home/kkoehne/dev/qt/qt-5/qtdeclarative/examples/tutorials/gettingStartedQml/texteditor.qml:52:5: Type MenuBar unavailable
Regards
Kai
PS:
In Qt 4 qDebug, qWarning etc just printed whatever was passed in. In Qt 5 we've been changing this (1) so that you can configure Qt to print additional information by setting the QT_MESSAGE_PATTERN environment variable. However, we didn't change the default so far - so without setting QT_MESSAGE_PATTERN we still just print the message. I just had a discussion (2) with Thiago Macieira and David Faure where we agreed that we'd like to still change this for Qt 5.0 ...
My personal motivation is that if e.g. the type would be always part of the message Qt Creator could use this information to colorize/filter output. Adding the app name / PID would identify the app in case of system logs, adding the function would give you a clue where on earth you added this one debug statement just printing "true" ;) So, what do you think about changing the default format to e.g.
"[%{type}] %{appname}(%{pid}) %{function} %{message}"
Example output:
[warning] QtCreator(16693) QtSupport::BaseQtVersion::qtVersionString - Cannot determine the Qt version: /home/kkoehne/dev/qt/test/bin/qmake cannot be run.
or
[warning] QtQmlViewer(16790) unknown - file:///home/kkoehne/dev/qt/qt-5/qtdeclarative/examples/tutorials/gettingStartedQml/texteditor.qml:52:5: Type MenuBar unavailable
Regards
Kai
PS: