Skip to content

Commit 3087973

Browse files
marc-hbgolowanow
authored andcommitted
logging_ctl.sh: change log aliases to functions
Change `dlog*` aliases to functions. Signed-off-by: Marc Herbert <marc.herbert@intel.com> Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
1 parent bf76a15 commit 3087973

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

case-lib/logging_ctl.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@ _func_log_cmd()
4444

4545
for key in "${!LOG_LIST[@]}";
4646
do
47-
# dymaic alias the command with different content
48-
cmd="alias $key='echo \$(date -u \"+%F %T %Z\")$ext_message ${LOG_LIST[$key]}'"
47+
# shellcheck disable=SC2016
48+
local date_cmd='$(date -u "+%F %T %Z")'
49+
local cmd="$key() { printf '%s%s %s\n' \"$date_cmd\" '$ext_message ${LOG_LIST[$key]}' \"\$*\" ; }"
4950
eval "$cmd"
5051
done
5152
}

0 commit comments

Comments
 (0)