From 632a6b36f66e5c1250467bbeffc0c40733bd4af0 Mon Sep 17 00:00:00 2001 From: "Erik M. Bray" Date: Fri, 20 May 2016 14:04:44 +0200 Subject: [PATCH] Make sage-logger output to stdout the name(s) of log(s) a line is being logged to. --- build/bin/sage-logger | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build/bin/sage-logger b/build/bin/sage-logger index 60ee3bca523..b4100942631 100755 --- a/build/bin/sage-logger +++ b/build/bin/sage-logger @@ -22,6 +22,7 @@ cmd="$1" logfile="$2" +logname="$(basename $logfile .log)" logdir=`dirname "$logfile"` mkdir -p "$logdir" @@ -29,7 +30,8 @@ mkdir -p "$logdir" # Redirect stdout and stderr to a subprocess running tee. # We trap SIGINT such that SIGINT interrupts the main process being # run, not the logging. -( exec 2>&1; eval "$cmd" ) | ( trap '' SIGINT; tee -a "$logfile" ) +( exec 2>&1; eval "$cmd" ) | ( trap '' SIGINT; tee -a "$logfile" ) | \ + (while read line; do echo [${logname}] $line; done) pipestatus=(${PIPESTATUS[*]})