diff --git a/bash/log.sh b/bash/log.sh index 5bb7906..069377e 100644 --- a/bash/log.sh +++ b/bash/log.sh @@ -5,16 +5,40 @@ LOG_LEVEL_INFO=3 LOG_LEVEL_DEBUG=4 LOG_LEVEL_TRACE=5 -LOG_LEVEL=${LOG_LEVEL_WARN} +LOG_LEVEL=${LOG_LEVEL_INFO} -log_fatal() { [ "${LOG_LEVEL}" -ge "${LOG_LEVEL_FATAL}" ] && echo "${@}" ; } +log_debug() { + if [ "${LOG_LEVEL}" -ge "${LOG_LEVEL_DEBUG}" ]; then + echo "${@}" + fi +} -log_error() { [ "${LOG_LEVEL}" -ge "${LOG_LEVEL_ERROR}" ] && echo "${@}" ; } +log_error() { + if [ "${LOG_LEVEL}" -ge "${LOG_LEVEL_ERROR}" ]; then + echo "${@}" + fi +} -log_warn() { [ "${LOG_LEVEL}" -ge "${LOG_LEVEL_WARN}" ] && echo "${@}" ; } +log_fatal() { + if [ "${LOG_LEVEL}" -ge "${LOG_LEVEL_FATAL}" ]; then + echo "${@}" + fi +} -log_info() { [ "${LOG_LEVEL}" -ge "${LOG_LEVEL_INFO}" ] && echo "${@}" ; } +log_info() { + if [ "${LOG_LEVEL}" -ge "${LOG_LEVEL_INFO}" ]; then + echo "${@}" + fi +} -log_debug() { [ "${LOG_LEVEL}" -ge "${LOG_LEVEL_DEBUG}" ] && echo "${@}" ; } +log_trace() { + if [ "${LOG_LEVEL}" -ge "${LOG_LEVEL_TRACE}" ]; then + echo "${@}" + fi +} -log_trace() { [ "${LOG_LEVEL}" -ge "${LOG_LEVEL_TRACE}" ] && echo "${@}" ; } +log_warn() { + if [ "${LOG_LEVEL}" -ge "${LOG_LEVEL_WARN}" ]; then + echo "${@}" + fi +}