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

Mateusz Łoskot mateusz at loskot.net
Wed Mar 22 13:36:26 EST 2006


Martin Dobias wrote:
> On 3/22/06, Mateusz Łoskot <mateusz at loskot.net> wrote:
>>Radim Blazek wrote:
>>>On 3/22/06, Mateusz Łoskot <mateusz at loskot.net> wrote:
>>>
>>>
>>>>But how the second macro should work?
>>>>Do you expect that everytime and everywhere debug output API is used, it
>>>>reads for QGIS_DEBUG_FILE and checks if it contains current file.
>>>>If it does, then debug output is turned on for this file.
>>>>Right?
>>>>
>>>>Basic example:
>>>>
>>>>GEOS_DEBUG_PRINT("this is my debug message")
>>>>
>>>>This macro is expanded to something like following operations:
>>>>
>>>>Now, when QGIS is executed, macro checks:
>>>>- is there any QGIS_DEBUG_FILE deined?
>>>>- if there is, check if it contains file with name of current
>>>>  file; here __FILE__ can be used
>>>>- if current file is there, print debug message, if not, just ignore it.
>>>>
>>>>Is this your idea?
>>>
>>>
>>>Yes.
>>
>>
>>Great and I like it :-)
>>
>>What is the current state of debug output?
>>I mean what is the current strategy?
>>
>>Does everyone agree with Radim's idea?
>>Should current technique be changed according to Radim's concept?
> 
> 
> I like this approach very much. Sometimes it's really hard to track
> debug messages I need it the flow of the other ones.

Yup, that's what this new technique should solve.

> I also don't like that construct #ifdef QGISDEBUG ... #endif which can
> be eliminated.

Sure.
It should be as only using simple macro, without all #ifdefs.

> Moreover it would be good to have some constants or so, which will
> indicate what kind of debug message is it - e.g. notice, warning,
> error, fatal. Then, a call like
> 
> DEBUG_PRINT(NOTICE, "This is just a notice")

I'd name all QGIS related macros starting from QGIS_,
e.g. QGIS_DEBUG_PRINT or QGIS_DEBUG_MSG

There were problems with GEOS on Windows, because it used macro named as 
DEBUG, which is defined and used by VC++ compiler.
So, it had to be changed to GEOS_DEBUG.

> would produce e.g.:
> NOTICE: This is just a notice.

Do you mean this additional argument should control
what is placed in front of the message?
Examples:

ERROR: This is an error
or for better readability:

#
# ERROR: This is an error
#

WARNING: This is a warning
NOTICE: This is a note

?

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



More information about the Qgis-developer mailing list