sonic-buildimage/scripts/process_log.sh
lguohan 20260ceb1d
[build]: add SONIC_CONFIG_BUILD_LOG_TIMESTAMP to add timestamp in build log (#4269)
add timestamp in each job build log

example:

   [01:39:21] dh clean  --with autotools-dev
   [01:39:22]    dh_auto_clean
   [01:39:27]      make -j16 distclean

Signed-off-by: Guohan Lu <lguohan@gmail.com>
2020-03-21 14:21:26 -07:00

21 lines
283 B
Bash
Executable File

#!/bin/bash
add_timestamp=""
while getopts ":t" opt; do
case $opt in
t)
add_timestamp="y"
;;
esac
done
while IFS= read -r line; do
if [ $add_timestamp ]; then
printf '[%s] ' "$(date +%T)"
fi
printf '%s\n' "$line"
done