44 lines
665 B
Bash
44 lines
665 B
Bash
LOG_LEVEL_FATAL=0
|
|
LOG_LEVEL_ERROR=1
|
|
LOG_LEVEL_WARN=2
|
|
LOG_LEVEL_INFO=3
|
|
LOG_LEVEL_DEBUG=4
|
|
LOG_LEVEL_TRACE=5
|
|
|
|
LOG_LEVEL=${LOG_LEVEL_INFO}
|
|
|
|
log_debug() {
|
|
if [ "${LOG_LEVEL}" -ge "${LOG_LEVEL_DEBUG}" ]; then
|
|
echo "${@}"
|
|
fi
|
|
}
|
|
|
|
log_error() {
|
|
if [ "${LOG_LEVEL}" -ge "${LOG_LEVEL_ERROR}" ]; then
|
|
echo "${@}"
|
|
fi
|
|
}
|
|
|
|
log_fatal() {
|
|
if [ "${LOG_LEVEL}" -ge "${LOG_LEVEL_FATAL}" ]; then
|
|
echo "${@}"
|
|
fi
|
|
}
|
|
|
|
log_info() {
|
|
if [ "${LOG_LEVEL}" -ge "${LOG_LEVEL_INFO}" ]; then
|
|
echo "${@}"
|
|
fi
|
|
}
|
|
|
|
log_trace() {
|
|
if [ "${LOG_LEVEL}" -ge "${LOG_LEVEL_TRACE}" ]; then
|
|
echo "${@}"
|
|
fi
|
|
}
|
|
|
|
log_warn() {
|
|
if [ "${LOG_LEVEL}" -ge "${LOG_LEVEL_WARN}" ]; then
|
|
echo "${@}"
|
|
fi
|
|
}
|