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: From an IDE perspective including the file + line would help so that you 
could just 'jump' to the source of a warning by clicking on it. However, the 
file string can get quite long (think about shadow builds) ... 

[1] Documented in  
http://doc-snapshot.qt-project.org/5.0/debug.html#warning-and-debugging-messages
[2] http://codereview.qt-project.org/#change,21655

--
Kai Koehne
Senior Software Engineer
Nokia, Mobile Phones
 
Nokia gate5 GmbH
Firmensitz: Invalidenstr. 117, 10115 Berlin, Germany
Registergericht: Amtsgericht Charlottenburg, Berlin: HRB 106443 B
Umsatzsteueridentifikationsnummer: DE 812 845 193
Geschäftsführer: Dr. Michael Halbherr, Karim Tähtivuori


_______________________________________________
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to