[Rear-users] SF.net SVN: rear:[561] trunk/usr/share/rear/lib/_input-output-functions.sh

dag- at users.sourceforge.net dag- at users.sourceforge.net
Mon Jun 6 01:24:58 CEST 2011


Revision: 561
          http://rear.svn.sourceforge.net/rear/?rev=561&view=rev
Author:   dag-
Date:     2011-06-05 23:24:58 +0000 (Sun, 05 Jun 2011)

Log Message:
-----------
For better profiling, add more precise timestamps to DEBUG and DEBUGSCRIPTS output

Modified Paths:
--------------
    trunk/usr/share/rear/lib/_input-output-functions.sh

Modified: trunk/usr/share/rear/lib/_input-output-functions.sh
===================================================================
--- trunk/usr/share/rear/lib/_input-output-functions.sh	2011-06-05 23:23:37 UTC (rev 560)
+++ trunk/usr/share/rear/lib/_input-output-functions.sh	2011-06-05 23:24:58 UTC (rev 561)
@@ -144,16 +144,22 @@
 	fi
 }
 
-Stamp() {
-	date +"%Y-%m-%d %H:%M:%S "
-}
+if [[ "$DEBUG" || "$DEBUG_SCRIPTS" ]]; then
+	Stamp() {
+		date +"%Y-%m-%d %H:%M:%S.%N "
+	}
+else
+	Stamp() {
+		date +"%Y-%m-%d %H:%M:%S "
+	}
+fi
 
 Log() {
 	if test $# -gt 0 ; then
-		echo "$(Stamp)$*" 
+		echo "$(Stamp)$*"
 	else
-		echo "$(Stamp)$(cat)" 
-	fi 1>&2
+		echo "$(Stamp)$(cat)"
+	fi >&2
 }
 
 # log if there is an error


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the rear-users mailing list