SH_LOG_LEVEL_FATAL=0 SH_LOG_LEVEL_ERROR=1 SH_LOG_LEVEL_WARN=2 SH_LOG_LEVEL_INFO=3 SH_LOG_LEVEL_DEBUG=4 SH_LOG_LEVEL_TRACE=5 SH_LOG_LEVEL=${SH_LOG_LEVEL_INFO} sh_log() { sh_log_info "${@}"; } sh_log_debug() { if [ "${SH_LOG_LEVEL}" -ge "${SH_LOG_LEVEL_DEBUG}" ]; then echo "[DEBUG]" "${@}" fi } sh_log_error() { if [ "${SH_LOG_LEVEL}" -ge "${SH_LOG_LEVEL_ERROR}" ]; then echo "[ERROR]" "${@}" >&2 fi } sh_log_fatal() { if [ "${SH_LOG_LEVEL}" -ge "${SH_LOG_LEVEL_FATAL}" ]; then echo "[FATAL]" "${@}" >&2 fi } sh_log_info() { if [ "${SH_LOG_LEVEL}" -ge "${SH_LOG_LEVEL_INFO}" ]; then echo "${@}" fi } sh_log_trace() { if [ "${SH_LOG_LEVEL}" -ge "${SH_LOG_LEVEL_TRACE}" ]; then echo "[TRACE]" "${@}" fi } sh_log_warn() { if [ "${SH_LOG_LEVEL}" -ge "${SH_LOG_LEVEL_WARN}" ]; then echo " [WARN]" "${@}" fi }