3 # LOGLEVEL 1: Crash condition
4 # LOGLEVEL 2: Unexpected condition
5 # LOGLEVEL 3: Failed action (i.e. due to config error)
8 [ -n "$include_logging" ] && return 0
11 LOGLEVEL="${LOGLEVEL:-3}"
12 LOGFILE="${LOGFILE:-/dev/stderr}"
15 if [ "${1:-3}" -le "$LOGLEVEL" ]; then
17 && printf %s\\n "$*" >>"${LOGFILE}" \
18 || tee -a "${LOGFILE}"
24 [ "$#" -gt 0 ] && logmsg 1 "$@"
27 panic(){ logmsg 2 "$@"; }
28 error(){ logmsg 3 "$@"; }
29 debug(){ logmsg 4 "$@"; }