helper function for test applications

Ralf Habacker ralf.habacker at freenet.de
Tue Mar 16 01:59:39 PDT 2010


Ralf Habacker schrieb:
> Colin Walters schrieb:
>> On Tue, Mar 9, 2010 at 4:20 PM, Ralf Habacker 
>> <ralf.habacker at freenet.de> wrote:
>>  
>>> The appended patch adds an internal function 
>>> _dbus_set_verbose(dbus_bool_t
>>> state)  which makes is possible to enable/disable verbose printing 
>>> from the
>>> code on places where it is really required and helps to save time.
>>>     
>>
>> Before I get into the small scale details, I think a function like:
>>
>> #ifdef POSIX
>> /**
>>  * Enable or disable verbose logging to the given file descriptor.
>>  * Only intended for debugging scenarios; verbose logging, especially
>>  * if directed synchronously to a file, can be a major performance
>>  * hit.
>>  *
>>  * @param enabled If %TRUE, enable extremely verbose logging
>>  * @param fd Unix file descriptor
>>  * @param flags Unused at this time
>> */
>> void
>> dbus_set_verbose_logging (dbus_bool_t enabled, int fd, int flags);
>> #else
>> void
>> dbus_set_verbose_logging (dbus_bool_t, HANDLE_OR_SOMETHING file, int 
>> flags);
>> #endif
>>
>> would be better. Having it always go to stderr is a little inflexible;
>>   
> On Windows there is already a solution for this by a configure option, 
> which send all output to the default windows debug port 
> http://msdn.microsoft.com/en-us/library/aa363362%28VS.85%29.aspx. In 
> all other cases stderr is sufficient. The only need is to 
> enable/disable debugging in program source.
>> Small scale stuff:
>>
>> s/noice/noise/
>>   
> ups,  I have overseen this
>> +void _dbus_set_verbose_real (dbus_bool_t state)
>>
>> Indentation is wrong, void should be on its own line.  
> do you have seen that all functions in dbus-internal.h are intended as 
> listed above ?
>> + * Implementation of dbus_set_verbose() macro if built with verbose 
>> logging
>> + * enabled.
>>
>> "Enable or disable verbose logging to standard error."
>>   
> As above said this does not fit into windows, because there are more 
> than one possible output channels. So I would change it to
> "Enable or disable verbose logging."
>
>> * Why are we DBUS_EXPORT anything from dbus-internals.h?  It looks
>> like your patch exported _dbus_is_verbose_real, but why?
>>   
> many dbus _dbus functions are located in the shared dbus-1 library 
> since the beginning of the windows port 
to be real correct - this was not introduced with the windows port, it 
was started much earlier.

> Regards
> Ralf
>
>
> _______________________________________________
> dbus mailing list
> dbus at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dbus



More information about the dbus mailing list