1
0
mirror of https://github.com/octoleo/hosts.git synced 2024-05-28 04:20:46 +00:00

Improve _debug().

This commit is contained in:
William Melody 2020-06-07 12:34:55 -07:00
parent fff87648d4
commit dfbc83e12c

21
hosts
View File

@ -90,23 +90,14 @@ _debug() {
if [[ "${_USE_DEBUG:-"0"}" -eq 1 ]] if [[ "${_USE_DEBUG:-"0"}" -eq 1 ]]
then then
__DEBUG_COUNTER=$((__DEBUG_COUNTER+1)) __DEBUG_COUNTER=$((__DEBUG_COUNTER+1))
# Prefix debug message with "bug (U+1F41B)" {
printf "🐛 %s " "${__DEBUG_COUNTER}" # Prefix debug message with "bug (U+1F41B)"
"${@}" printf "🐛 %s " "${__DEBUG_COUNTER}"
printf "――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――\\n" "${@}"
printf "―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――\\n"
} 1>&2
fi fi
} }
# debug()
#
# Usage:
# debug "Debug info. Variable: $0"
#
# Print the specified message if the `$_USE_DEBUG` variable has been set.
#
# This is a shortcut for the _debug() function that simply echos the message.
debug() {
_debug echo "${@}"
}
############################################################################### ###############################################################################
# Error Messaging # Error Messaging