about summary refs log tree commit diff
path: root/nscd
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2009-10-29 13:45:10 -0700
committerUlrich Drepper <drepper@redhat.com>2009-10-29 13:45:10 -0700
commite0f471a1187cdfcb029c80819da52b4c12e352f5 (patch)
treee0676aede3a0fc1b937d357e14ad728fdf90b78a /nscd
parentd79eccd6dd8aa2038a9775689a7072fe3ceb40dc (diff)
downloadglibc-e0f471a1187cdfcb029c80819da52b4c12e352f5.tar.gz
glibc-e0f471a1187cdfcb029c80819da52b4c12e352f5.tar.xz
glibc-e0f471a1187cdfcb029c80819da52b4c12e352f5.zip
Print timestamp in nscd debug messages.
Diffstat (limited to 'nscd')
-rw-r--r--nscd/dbg_log.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/nscd/dbg_log.c b/nscd/dbg_log.c
index 5e192c97dd..fa99dac88f 100644
--- a/nscd/dbg_log.c
+++ b/nscd/dbg_log.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1998, 2000, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (c) 1998, 2000, 2004, 2005, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1998.
 
@@ -53,14 +53,23 @@ void
 dbg_log (const char *fmt,...)
 {
   va_list ap;
-  char msg[512], msg2[512];
+  char msg2[512];
 
   va_start (ap, fmt);
-  vsnprintf (msg2, sizeof (msg), fmt, ap);
+  vsnprintf (msg2, sizeof (msg2), fmt, ap);
 
   if (debug_level > 0)
     {
-      snprintf (msg, sizeof (msg), "%d: %s%s", getpid (), msg2,
+      time_t t = time (NULL);
+
+      struct tm now;
+      localtime_r (&t, &now);
+
+      char buf[256];
+      strftime (buf, sizeof (buf), "%c", &now);
+
+      char msg[512];
+      snprintf (msg, sizeof (msg), "%s - %d: %s%s", buf, getpid (), msg2,
 		msg2[strlen (msg2) - 1] == '\n' ? "" : "\n");
       if (dbgout)
 	{