CVS User Account cvsuser
Thu Sep 23 17:37:50 PDT 2004
Log Message:
-----------
 Add time stamps to log messages

Modified Files:
--------------
    slony1-engine/src/slon:
        misc.c (r1.10 -> r1.11)

-------------- next part --------------
Index: misc.c
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/slon/misc.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -Lsrc/slon/misc.c -Lsrc/slon/misc.c -u -w -r1.10 -r1.11
--- src/slon/misc.c
+++ src/slon/misc.c
@@ -43,7 +43,10 @@
 	static char	   *outbuf = NULL;
 	static int		outsize = -1;
 	int				off;
-	char		   *level_c = NULL;;
+	char		   *level_c = NULL;
+
+	char		time_buf[128];
+	time_t		stamp_time = time(NULL);
 
 	if (level > slon_log_level)
 		return;
@@ -85,7 +88,9 @@
 		}
 	}
 
-	sprintf(outbuf, "%-6.6s ", level_c); /* date and time here too */
+	strftime(time_buf, sizeof(time_buf), "%Y-%m-%d %H:%M:%S %Z", localtime(&stamp_time));
+
+	sprintf(outbuf, "%-6.6s [%s] ", level_c, time_buf);
 	off = strlen(outbuf);
 
 	while(vsnprintf(&outbuf[off], outsize - off, fmt, ap) >= outsize - off)


More information about the Slony1-commit mailing list