This is the mail archive of the cygwin-xfree mailing list for the Cygwin XFree86 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch 5/7] Cygwin/X: Add a timestamp to log messages


Add a timestamp to log messages
Also tidy up a few stray "\n" issues

---
 xserver/dix/registry.c       |    2 +-
 xserver/hw/xwin/winprocarg.c |    4 ++--
 xserver/os/log.c             |   18 ++++++++++++++++--
 3 files changed, 19 insertions(+), 5 deletions(-)

Index: xorg-server-1.5.3/xserver/os/log.c
===================================================================
--- xorg-server-1.5.3.orig/xserver/os/log.c	2009-01-14 00:29:32.922875000 +0000
+++ xorg-server-1.5.3/xserver/os/log.c	2009-01-14 00:30:06.828125000 +0000
@@ -253,6 +253,7 @@
 LogVWrite(int verb, const char *f, va_list args)
 {
     static char tmpBuffer[1024];
+    static char tmpBuffer2[1024];
     int len = 0;
 
     /*
@@ -261,8 +262,21 @@
      * stream(s).
      */
     if (verb < 0 || logFileVerbosity >= verb || logVerbosity >= verb) {
-	vsnprintf(tmpBuffer, sizeof(tmpBuffer), f, args);
-	len = strlen(tmpBuffer);
+	vsnprintf(tmpBuffer2, sizeof(tmpBuffer), f, args);
+	len = strlen(tmpBuffer2);
+
+        if (len > 0)
+          {
+            /* Format the date and time per ISO8601 */
+            time_t t = time(NULL);
+            struct tm tm;
+            localtime_r(&t, &tm);
+            strftime(tmpBuffer, sizeof(tmpBuffer2), "%FT%T ",  &tm);
+
+            /* Concatente the string produced by formating the va_list */
+            strncat(tmpBuffer, tmpBuffer2, sizeof(tmpBuffer));
+            len = strlen(tmpBuffer);
+          }
     }
     if ((verb < 0 || logVerbosity >= verb) && len > 0)
 	fwrite(tmpBuffer, len, 1, stderr);
Index: xorg-server-1.5.3/xserver/hw/xwin/winprocarg.c
===================================================================
--- xorg-server-1.5.3.orig/xserver/hw/xwin/winprocarg.c	2009-01-13 17:20:47.000000000 +0000
+++ xorg-server-1.5.3/xserver/hw/xwin/winprocarg.c	2009-01-14 01:43:03.734375000 +0000
@@ -1550,8 +1550,8 @@
 
   ErrorF ("Welcome to the XWin X Server\n");
   ErrorF ("Vendor: %s\n", VENDOR_STRING);
-  ErrorF ("Release: %d.%d.%d.%d (%d)\n\n", XORG_VERSION_MAJOR, XORG_VERSION_MINOR, XORG_VERSION_PATCH, XORG_VERSION_SNAP, XORG_VERSION_CURRENT);
-  ErrorF ("Contact: %s\n\n", VENDOR_CONTACT);
+  ErrorF ("Release: %d.%d.%d.%d (%d)\n", XORG_VERSION_MAJOR, XORG_VERSION_MINOR, XORG_VERSION_PATCH, XORG_VERSION_SNAP, XORG_VERSION_CURRENT);
+  ErrorF ("Contact: %s\n", VENDOR_CONTACT);
 }
 
 /*
Index: xorg-server-1.5.3/xserver/dix/registry.c
===================================================================
--- xorg-server-1.5.3.orig/xserver/dix/registry.c	2008-10-02 22:01:24.000000000 +0100
+++ xorg-server-1.5.3/xserver/dix/registry.c	2009-01-14 01:46:01.890625000 +0000
@@ -313,7 +313,7 @@
 	fclose(fh);
     fh = fopen(FILENAME, "r");
     if (!fh)
-	LogMessage(X_WARNING, "Failed to open protocol names file " FILENAME);
+	LogMessage(X_WARNING, "Failed to open protocol names file " FILENAME "\n");
 
     /* Add built-in resources */
     RegisterResourceName(RT_NONE, "NONE");

-- 


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]