helper function for test applications
ralf.habacker at freenet.de
Sun Mar 14 05:40:18 PDT 2010
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
> dbus_set_verbose_logging (dbus_bool_t enabled, int fd, int flags);
> dbus_set_verbose_logging (dbus_bool_t, HANDLE_OR_SOMETHING file, int flags);
> 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:
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 and has to be exported from the library.
This can be done either by having a def file
by using the DBUS_EXPORT macro, which is introduced by the two previous
patches, on which this patches is based.
More information about the dbus