Only print timestamps on stderr if verbose messages will go there
authorRalf Habacker <ralf.habacker@freenet.de>
Fri, 10 Feb 2017 12:10:49 +0000 (13:10 +0100)
committerRalf Habacker <ralf.habacker@freenet.de>
Fri, 10 Feb 2017 12:10:49 +0000 (13:10 +0100)
On Windows, dbus can be configured to send DBUS_VERBOSE messages
to the Windows debug port instead of stderr. If we're in that
configuration, we already avoided printing thread information to
stderr before each verbose message; do the same for timestamps.

Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=99749

dbus/dbus-internals.c

index 9e515da..1fb6f02 100644 (file)
@@ -395,7 +395,6 @@ _dbus_verbose_real (
   static dbus_bool_t need_pid = TRUE;
   int len;
   long sec, usec;
-  _dbus_get_real_time (&sec, &usec);
   
   /* things are written a bit oddly here so that
    * in the non-verbose case we just have the one
@@ -410,8 +409,9 @@ _dbus_verbose_real (
     {
       _dbus_print_thread ();
     }
-#endif
+  _dbus_get_real_time (&sec, &usec);
   fprintf (stderr, "%ld.%06ld ", sec, usec);
+#endif
 
   /* Only print pid again if the next line is a new line */
   len = strlen (format);