helper function for test applications

Colin Walters walters at verbum.org
Fri Mar 12 07:02:46 PST 2010


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;
this way an app author can more easily split things up into separate
log files if they want, or even set up an internal pipe and filter the
stream for targeted messages.  Also we shouldn't really be treating
functions which start with _ as public.

Small scale stuff:

s/noice/noise/

+void _dbus_set_verbose_real (dbus_bool_t state)

Indentation is wrong, void should be on its own line.  Actually I'm
noticing other code now from the win32 work which is incorrect in this
area...

+ * Implementation of dbus_set_verbose() macro if built with verbose logging
+ * enabled.

"Enable or disable verbose logging to standard error."

* Why are we DBUS_EXPORT anything from dbus-internals.h?  It looks
like your patch exported _dbus_is_verbose_real, but why?


More information about the dbus mailing list