This commit is contained in:
Marc Beninca 2024-11-19 09:58:15 +01:00
parent 2089e8c1e0
commit fbe30920d7
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -16,14 +16,22 @@ sh_log_debug() {
}
sh_log_error() {
local code="${1}"
shift
[ -n "${code}" ] || sh_log_fatal 1 "No error code"
if [ "${SH_LOG_LEVEL}" -ge "${SH_LOG_LEVEL_ERROR}" ]; then
echo "[ERROR]" "${@}" >&2
return "${code}"
fi
}
sh_log_fatal() {
local code="${1}"
shift
[ -n "${code}" ] || sh_log_fatal 1 "No error code"
if [ "${SH_LOG_LEVEL}" -ge "${SH_LOG_LEVEL_FATAL}" ]; then
echo "[FATAL]" "${@}" >&2
exit "${code}"
fi
}