chore: fix logging in bin/emqx on non-tty

This commit is contained in:
Ivan Dyachkov 2022-12-19 14:53:28 +01:00
parent 7aee1a08aa
commit 4a9be95f6d
1 changed files with 10 additions and 2 deletions

View File

@ -54,11 +54,19 @@ export ERTS_LIB_DIR="$RUNNER_ROOT_DIR/lib"
DYNLIBS_DIR="$RUNNER_ROOT_DIR/dynlibs"
logerr() {
echo -e "$(tput setaf 1)ERROR: $*$(tput sgr0)" 1>&2
if [ "${TERM:-dumb}" = dumb ]; then
echo -e "ERROR: $*" 1>&2
else
echo -e "$(tput setaf 1)ERROR: $*$(tput sgr0)" 1>&2
fi
}
logwarn() {
echo "$(tput setaf 3)WARNING: $*$(tput sgr0)"
if [ "${TERM:-dumb}" = dumb ]; then
echo "WARNING: $*"
else
echo "$(tput setaf 3)WARNING: $*$(tput sgr0)"
fi
}
die() {