[Development] Work on qDebug and friends

David Faure faure at kde.org
Fri Feb 3 12:10:03 CET 2012


On Friday 03 February 2012 10:51:50 kai.koehne at nokia.com wrote:
> Finally I came around to actually implement something:
> 
> http://codereview.qt-project.org/#change,15129
> 
> The idea is that you can customize the output by setting the
> QT_DEBUG_PATTERN environment variable. Setting it e.g. to
> 
> "[%type%] %file%:%line% %function% %message%" 
> 
> Would generate lines like:
> 
> [debug] ../helloworld/main.cpp:7 main HELLO WORLD

Excellent idea!!!
Much better than my 6 env vars in KDE!

Once this goes in I'll add support for %pid%, %processname% and %timestamp%, 
and we'll be all set :)

> However, I'm not really sure whether that belongs into Qt Core or not.

I would definitely like it to go there.
A separate module that apps have to link to and initialize, only helps the 
case of "a developer working on his own application". It doesn't help the more 
general case of "an opensource developer/user debugging an existing 
application, or a whole set of applications in an existing framework/desktop".
There's no way to patch all apps just to be able to distinguish their output 
in ~/.xsession-errors.

I agree with logging to files, sockets, syslog etc. being in a separate addon.
But I would say that making the basic output useful belongs in Qt Core, so 
that *all* Qt applications in the world can benefit from it.

-- 
David Faure, faure at kde.org, http://www.davidfaure.fr
Sponsored by Nokia to work on KDE, incl. KDE Frameworks 5




More information about the Development mailing list