From: Michael Tremer Date: Fri, 5 Jul 2024 09:39:08 +0000 (+0000) Subject: make.sh: Create a custom log function X-Git-Tag: v2.29-core188~10^2~348 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=74371ed5b6abf0a5616d9837542add7e8b85bded;p=ipfire-2.x.git make.sh: Create a custom log function Signed-off-by: Michael Tremer --- diff --git a/make.sh b/make.sh index a8855c7c42..f94fb38bda 100755 --- a/make.sh +++ b/make.sh @@ -95,6 +95,21 @@ resize_terminal # Call resize_terminal when terminal is being resized trap "resize_terminal" WINCH +# Writes a line to the log file +log() { + local line="$@" + + # Fetch the current timestamp + local t="$(date -u "+%b %e %T")" + + # Append the line to file + if [ -w "${LOGFILE}" ]; then + echo "${t}: ${line}" >> "${LOGFILE}" + fi + + return 0 +} + find_base() { local path