Skip to content

Commit

Permalink
replacing [[ #32
Browse files Browse the repository at this point in the history
  • Loading branch information
simonmysun committed Aug 26, 2024
1 parent aee080a commit b219eda
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions helpers/logging.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
# logging functions
# the logs are written to stderr so that they don't interfere with pipes

[[ ${TO_TTY} == true ]] && LOG_STYLE_RESET="$(printf "\033[0m")" || LOG_STYLE_RESET="";
[[ ${TO_TTY} == true ]] && LOG_STYLE_PUNC="$(printf "\033[0m\033[2m")" || LOG_STYLE_PUNC="";
[[ ${TO_TTY} == true ]] && LOG_STYLE_DEBUG="$(printf "\033[97m\033[1m")" || LOG_STYLE_DEBUG="";
[[ ${TO_TTY} == true ]] && LOG_STYLE_INFO="$(printf "\033[92m\033[1m")" || LOG_STYLE_INFO="";
[[ ${TO_TTY} == true ]] && LOG_STYLE_WARN="$(printf "\033[96m\033[1m")" || LOG_STYLE_WARN="";
[[ ${TO_TTY} == true ]] && LOG_STYLE_ERROR="$(printf "\033[93m\033[1m")" || LOG_STYLE_ERROR="";
[[ ${TO_TTY} == true ]] && LOG_STYLE_FATAL="$(printf "\033[91m\033[1m")" || LOG_STYLE_FATAL="";

function logging_debug() {
[ "x${TO_TTY}" = xtrue ] && LOG_STYLE_RESET="$(printf "\033[0m")" || LOG_STYLE_RESET="";
[ "x${TO_TTY}" = xtrue ] && LOG_STYLE_PUNC="$(printf "\033[0m\033[2m")" || LOG_STYLE_PUNC="";
[ "x${TO_TTY}" = xtrue ] && LOG_STYLE_DEBUG="$(printf "\033[97m\033[1m")" || LOG_STYLE_DEBUG="";
[ "x${TO_TTY}" = xtrue ] && LOG_STYLE_INFO="$(printf "\033[92m\033[1m")" || LOG_STYLE_INFO="";
[ "x${TO_TTY}" = xtrue ] && LOG_STYLE_WARN="$(printf "\033[96m\033[1m")" || LOG_STYLE_WARN="";
[ "x${TO_TTY}" = xtrue ] && LOG_STYLE_ERROR="$(printf "\033[93m\033[1m")" || LOG_STYLE_ERROR="";
[ "x${TO_TTY}" = xtrue ] && LOG_STYLE_FATAL="$(printf "\033[91m\033[1m")" || LOG_STYLE_FATAL="";

logging_debug() {
if [ "${ELL_LOG_LEVEL}" -ge 5 ]; then
echo "${LOG_STYLE_PUNC}[${LOG_STYLE_RESET}$(date +'%Y-%m-%d %H:%M:%S')${LOG_STYLE_PUNC}]${LOG_STYLE_RESET} $(basename "${0}") ${LOG_STYLE_DEBUG}DEBUG${LOG_STYLE_RESET} ${*}" >&2;
fi
Expand Down

0 comments on commit b219eda

Please sign in to comment.