[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#630089: timestamped build logs?



On Thu, Jan 12, 2012 at 06:56:48PM +0100, Daniel Baumann wrote:
> On 01/12/2012 06:14 PM, Colin Watson wrote:
> > Echo_verbose "%s: Running %s" "$(date -R)" "${COMMAND} ${@}"
> 
> this will produce rather longish-imho-not-eye-friendly messages in the
> style of
> 
>   Thu, 12 Jan 2012 18:52:01 +0100 Running lb foo --verbose
> 
> i'd prefere something shorter, like:
> 
>   [2012-01-12 18:51:35] lb foo --verbose

Fair enough.

> maybe we could even use that by default, what do you think?

Oh, well that certainly simplifies things if you're happy with that, and
I expect I'd find that useful.  Updated patch follows.

diff --git a/scripts/build/lb b/scripts/build/lb
index 58c1d12..4bb76cb 100755
--- a/scripts/build/lb
+++ b/scripts/build/lb
@@ -44,16 +44,19 @@ case "${1}" in
 
 		if [ -x "${LB_BASE}/scripts/build/${COMMAND}" ]
 		then
-			LB=1 exec "${LB_BASE}/scripts/build/${COMMAND}" "${@}"
+			SCRIPT="${LB_BASE}/scripts/build/${COMMAND}"
 		elif [ -x /usr/share/live/build/scripts/build/${COMMAND} ]
 		then
-			LB=1 exec /usr/share/live/build/scripts/build/"${COMMAND}" "${@}"
+			SCRIPT=/usr/share/live/build/scripts/build/"${COMMAND}"
 		elif [ -x "$(which ${COMMAND} 2>/dev/null)" ]
 		then
-			LB=1 exec "${COMMAND}" "${@}"
+			SCRIPT="${COMMAND}"
 		else
 			Echo_error "no such script"
 			exit 1
 		fi
+
+		Echo "[%s] %s" "$(date +'%F %T')" "${COMMAND} ${*}"
+		LB=1 exec "${SCRIPT}" "${@}"
 		;;
 esac

Thanks,

-- 
Colin Watson                                       [cjwatson@ubuntu.com]



Reply to: