Avoid leading ": " in the log output when there are no prefixes.
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Fri, 12 Aug 2016 05:37:58 +0000 (01:37 -0400)
committerWerner Koch <wk@gnupg.org>
Fri, 12 Aug 2016 10:18:17 +0000 (12:18 +0200)
* common/logging.c (do_logv): When no prefixes have been requested,
omit the ": " separator, since there is nothing on the left-hand
side of it.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
common/logging.c

index b6bafc7..c70ba35 100644 (file)
@@ -687,14 +687,15 @@ do_logv (int level, int ignore_arg_ptr, const char *fmt, va_list arg_ptr)
           else
             es_fprintf_unlocked (logstream, "[%u]", (unsigned int)getpid ());
         }
-      if (!with_time || force_prefixes)
+      if ((!with_time && (with_prefix || with_pid)) || force_prefixes)
         es_putc_unlocked (':', logstream);
       /* A leading backspace suppresses the extra space so that we can
          correctly output, programname, filename and linenumber. */
       if (fmt && *fmt == '\b')
         fmt++;
       else
-        es_putc_unlocked (' ', logstream);
+        if (with_time || with_prefix || with_pid || force_prefixes)
+          es_putc_unlocked (' ', logstream);
     }
 
   switch (level)