diff options
Diffstat (limited to 'subr/ex_rtl_log.subr')
-rw-r--r-- | subr/ex_rtl_log.subr | 78 |
1 files changed, 0 insertions, 78 deletions
diff --git a/subr/ex_rtl_log.subr b/subr/ex_rtl_log.subr deleted file mode 100644 index 514d4636..00000000 --- a/subr/ex_rtl_log.subr +++ /dev/null @@ -1,78 +0,0 @@ -# -# set +o errexit -o noglob is assumed. -# - -: ${DEFAULT_LOG_MSG_FAIL_COLOUR:=91}; -: ${DEFAULT_LOG_MSG_INFO_COLOUR:=93}; -: ${DEFAULT_LOG_MSG_INF2_COLOUR:=33}; -: ${DEFAULT_LOG_MSG_SUCC_COLOUR:=92}; -: ${DEFAULT_LOG_MSG_SUC2_COLOUR:=32}; -: ${DEFAULT_LOG_MSG_VNFO_COLOUR:=96}; -: ${DEFAULT_LOG_MSG_VUCC_COLOUR:=90}; -: ${DEFAULT_LOG_MSG_VVFO_COLOUR:=96}; -: ${DEFAULT_LOG_MSG_VVVO_COLOUR:=96}; -: ${DEFAULT_LOG_MSG_VVVV_COLOUR:=96}; - -exp_rtl_log_printf() { - local _attrs="${1}" _msg=""; shift; _msg="$(printf "${@}")"; - if [ "${BUILD_IS_PARENT:-0}" -eq 1 ]\ - && [ -n "${DEFAULT_BUILD_LOG_FNAME}" ]\ - && [ -e "${DEFAULT_BUILD_LOG_FNAME}" ]; then - printf "%s\n" "${_msg}" >> "${DEFAULT_BUILD_LOG_FNAME}"; - fi; - printf "\033[0m\033[${_attr}m%s\033[0m\n" "${_msg}"; -}; - -ex_rtl_log_env_vars() { - local _nvar=1 _arg="" _arg_len_max=0; - ex_rtl_log_msg info "Variables for this ${1:-build}:"; shift; - while [ ${_nvar} -le ${#} ]; do - _arg="$(eval echo \${${_nvar}})"; - _arg="${_arg%%=*}"; - if [ ${#_arg} -gt ${_arg_len_max} ]; then - _arg_len_max=${#_arg}; - fi; : $((_nvar+=1)); - done; - while [ ${#} -gt 0 ]; do - ex_rtl_log_msg info "$(printf \ - "%${_arg_len_max}.${_arg_len_max}s=%s" \ - "${1%%=*}" "$(ex_rtl_get_var_unsafe ${1#*=})")"; - shift; - done; -}; - -ex_rtl_log_set_vnfo_lvl() { - EXP_RTL_LOG_VNFO_LVL="${1}"; -}; - -ex_rtl_log_msg() { - local _lvl="${1}" _lvl_uc="" _attr=""; shift; - if [ "${_lvl}" = vnfo ]\ - || [ "${_lvl}" = vucc ]\ - && [ "${EXP_RTL_LOG_VNFO_LVL:-0}" -lt 1 ]; then - return; - elif [ "${_lvl}" = vvfo ]\ - && [ "${EXP_RTL_LOG_VNFO_LVL:-0}" -lt 2 ]; then - return; - elif [ "${_lvl}" = vvvo ]\ - && [ "${EXP_RTL_LOG_VNFO_LVL:-0}" -lt 3 ]; then - return; - elif [ "${_lvl}" = vvvv ]\ - && [ "${EXP_RTL_LOG_VNFO_LVL:-0}" -lt 4 ]; then - return; - fi; - _lvl_uc="$(ex_rtl_toupper "${_lvl%exit}")"; - _attr="$(ex_rtl_get_var_unsafe "DEFAULT_LOG_MSG_${_lvl_uc}_COLOUR")"; - if [ ${#} -gt 1 ]; then - exp_rtl_log_printf "${_attrs}" "==> %s %s %s" "$(ex_rtl_date)" "${1}" "$*"; - else - exp_rtl_log_printf "${_attrs}" "==> %s %s" "$(ex_rtl_date)" "${1}"; - fi; - if [ ${_lvl} = failexit ]; then - exit 1; - else - return 0; - fi; -}; - -# vim:filetype=sh |