[Qgis-developer] prints to std::cout in qgis

Mateusz Łoskot mateusz at loskot.net
Wed Mar 22 09:13:08 EST 2006


nhugent at hispeed.ch wrote:
> My suggestion is to not use std::cout for debug messages anymore, but
>  rather the QgsDebug macro (which calls qDebug).

I agree with Marco.
I'd also suggest to provide a macro that can be used to control debug
messages per file (pair of .h/.cpp files).
The idea is to turn all debug messages off and leave turned on
only debug messages on for one particular file.
This will help much to filter/track only objects/operations we are
interested in when working on single feature/file.
Now, QGIS debug mechanism outputs huge amount of messages and many of
them are useless in many cases, so they should be filtered when not needed.
This approach is used in GEOS and it works well.

There is a macro GEOS_DEBUG that is turned off by default.
But if someone want to debug/test e.g. Envelope class, then he has to
put one line into Envelope.cpp file:

#define GEOS_DEBUG 1

This solution could be improved to turn on/off all debug messages
globally or turn them on/off for particular file using local macro (like
the GEOS_DEBUG).

Cheers
-- 
Mateusz Łoskot
http://mateusz.loskot.net



More information about the Qgis-developer mailing list