diff options
Diffstat (limited to 'lib/logging.bash')
| -rw-r--r-- | lib/logging.bash | 82 |
1 files changed, 75 insertions, 7 deletions
diff --git a/lib/logging.bash b/lib/logging.bash index 37b947d..b54db65 100644 --- a/lib/logging.bash +++ b/lib/logging.bash @@ -26,10 +26,78 @@ log() { ## ## Log a debug-level message. This message only shows if BASHTARD_DEBUG ## evaluates to a truthy value. -debug() { [[ -n $BASHTARD_DEBUG ]] && log "$1" "$(printf "\e[0;37m%s" "${@:2}")" ; } -info() { log "$1" "$(printf "\e[m%s" "${@:2}")" ; } -notice() { log "$1" "$(printf "\e[0;34m%s" "${@:2}")" ; } -warn() { log "$1" "$(printf "\e[1;39m%s" "${@:2}")" ; } -crit() { log "$1" "$(printf "\e[0;33m%s" "${@:2}")" ; } -alert() { log "$1" "$(printf "\e[0;31m%s" "${@:2}")" ; } -emerg() { log "$1" "$(printf "\e[1;31m%s" "${@:2}")" ; } +debug() { + [[ -n $BASHTARD_DEBUG ]] && log "$1" "$(printf "\e[0;37m%s" "${@:2}")" +} + +## :bocs: +## :section: 3 +## :heading: functions +## :name: info +## :param: The system to log for. +## :param: The message to log. +## +## Log an info-level message. +info() { + log "$1" "$(printf "\e[m%s" "${@:2}")" +} + +## :bocs: +## :section: 3 +## :heading: functions +## :name: notice +## :param: The system to log for. +## :param: The message to log. +## +## Log an notice-level message. +notice() { + log "$1" "$(printf "\e[0;34m%s" "${@:2}")" +} + +## :bocs: +## :section: 3 +## :heading: functions +## :name: warn +## :param: The system to log for. +## :param: The message to log. +## +## Log an warning-level message. +warn() { + log "$1" "$(printf "\e[1;39m%s" "${@:2}")" +} + +## :bocs: +## :section: 3 +## :heading: functions +## :name: crit +## :param: The system to log for. +## :param: The message to log. +## +## Log an critical-level message. +crit() { + log "$1" "$(printf "\e[0;33m%s" "${@:2}")" +} + +## :bocs: +## :section: 3 +## :heading: functions +## :name: alert +## :param: The system to log for. +## :param: The message to log. +## +## Log an alert-level message. +alert() { + log "$1" "$(printf "\e[0;31m%s" "${@:2}")" +} + +## :bocs: +## :section: 3 +## :heading: functions +## :name: emerg +## :param: The system to log for. +## :param: The message to log. +## +## Log an emergency-level message. +emerg() { + log "$1" "$(printf "\e[1;31m%s" "${@:2}")" +} |
