From a6f0137756372ebf79ce76f356f2ee949b1e5a1b Mon Sep 17 00:00:00 2001
From: Olav Morken <olav.morken@uninett.no>
Date: Wed, 3 Nov 2010 08:18:44 +0000
Subject: [PATCH] Logger: Add timestamp to captured log.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2618 44740490-163a-0410-bde0-09ae8108e29a
---
 lib/SimpleSAML/Logger.php | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/SimpleSAML/Logger.php b/lib/SimpleSAML/Logger.php
index 6aaadc73f..f786ccb16 100644
--- a/lib/SimpleSAML/Logger.php
+++ b/lib/SimpleSAML/Logger.php
@@ -171,7 +171,12 @@ class SimpleSAML_Logger {
 		}
 
 		
-		if (self::$captureLog) self::$capturedLog[] = $string;
+		if (self::$captureLog) {
+			$ts = microtime(TRUE);
+			$msecs = (int)(($ts - (int)$ts) * 1000);
+			$ts = GMdate('H:i:s', $ts) . sprintf('.%03d', $msecs) . 'Z';
+			self::$capturedLog[] = $ts . ' ' . $string;
+		}
 		
 		if (self::$logLevel >= $level || $statsLog) {
 			if (is_array($string)) $string = implode(",",$string);
-- 
GitLab