[pkg-fso-commits] [SCM] Automatic Display Manager branch, master, updated. debian/0.8-1-12-g387dda5

Enrico Zini enrico at enricozini.org
Sat Jul 9 00:02:07 UTC 2011


The following commit has been merged in the master branch:
commit 104d4e3dd2df6b5ece42401b43e913a5b6537ce2
Author: Enrico Zini <enrico at enricozini.org>
Date:   Sat Jul 9 01:00:36 2011 +0100

    Log timestamps on stderr

diff --git a/log.c b/log.c
index 04dba46..d5a69c6 100644
--- a/log.c
+++ b/log.c
@@ -22,6 +22,7 @@
 #include <syslog.h>
 #include <stdio.h>
 #include <stdarg.h>
+#include <sys/time.h>
 
 static const struct log_config* config = 0;
 
@@ -53,7 +54,12 @@ static void log_common(int prio, const char* fmt, va_list ap)
     {
         va_list loc;
         va_copy(loc, ap);
-        fprintf(stderr, "%s:", config->program_name);
+        struct timeval now;
+        gettimeofday(&now, NULL);
+        fprintf(stderr, "%u.%u %s:",
+               (unsigned)now.tv_sec,
+               (unsigned)now.tv_usec,
+               config->program_name);
         vfprintf(stderr, fmt, loc);
         va_end(loc);
         fputc('\n', stderr);

-- 
Automatic Display Manager



More information about the pkg-fso-commits mailing list