log/log
This commit is contained in:
parent
9a2603c6de
commit
ef4879efd7
1 changed files with 15 additions and 15 deletions
|
@ -19,9 +19,21 @@ RWX_LOG_LEVEL_TRACE=5
|
|||
|
||||
rwx_log_level=${RWX_LOG_LEVEL_INFO}
|
||||
|
||||
# ╭─────┬─────╮
|
||||
# │ log │ log │
|
||||
# ╰─────┴─────╯
|
||||
# ╭─────┬───────────╮
|
||||
# │ log │ functions │
|
||||
# ╰─────┴───────────╯
|
||||
|
||||
_rwx_log() {
|
||||
local prefix="${1}"
|
||||
shift
|
||||
[ ${#} -gt 0 ] || set -- ""
|
||||
local line
|
||||
for line in "${@}"; do
|
||||
[ -n "${prefix}" ] &&
|
||||
printf "%s" "[${prefix}] "
|
||||
echo "${line}"
|
||||
done
|
||||
}
|
||||
|
||||
rwx_log_debug() {
|
||||
if [ "${rwx_log_level}" -ge "${RWX_LOG_LEVEL_DEBUG}" ]; then
|
||||
|
@ -67,15 +79,3 @@ rwx_log_warn() {
|
|||
_rwx_log " WARN" "${@}"
|
||||
fi
|
||||
}
|
||||
|
||||
_rwx_log() {
|
||||
local prefix="${1}"
|
||||
shift
|
||||
[ ${#} -gt 0 ] || set -- ""
|
||||
local line
|
||||
for line in "${@}"; do
|
||||
[ -n "${prefix}" ] &&
|
||||
printf "%s" "[${prefix}] "
|
||||
echo "${line}"
|
||||
done
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue