Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add logging functions (by @Kreyren) #290

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 22 additions & 8 deletions lib/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -221,14 +221,28 @@ _omb_term_color_initialize
#
# Headers and Logging
#
function _omb_log_header { printf "\n${_omb_term_bold}${_omb_term_violet}========== %s ==========${_omb_term_reset}\n" "$@"; }
function _omb_log_arrow { printf "➜ %s\n" "$@"; }
function _omb_log_success { printf "${_omb_term_green}✔ %s${_omb_term_reset}\n" "$@"; }
function _omb_log_error { printf "${_omb_term_brown}✖ %s${_omb_term_reset}\n" "$@"; }
function _omb_log_warning { printf "${_omb_term_olive}➜ %s${_omb_term_reset}\n" "$@"; }
function _omb_log_underline { printf "${_omb_term_underline}${_omb_term_bold}%s${_omb_term_reset}\n" "$@"; }
function _omb_log_bold { printf "${_omb_term_bold}%s${_omb_term_reset}\n" "$@"; }
function _omb_log_note { printf "${_omb_term_underline}${_omb_term_bold}${_omb_term_navy}Note:${_omb_term_reset} ${_omb_term_olive}%s${_omb_term_reset}\n" "$@"; }
# Note: Define logging functions only when there are no existing
# definitions so that the end user can customize the error handling.
_omb_util_command_exists _omb_log_header ||
function _omb_log_header { printf "\n${_omb_term_bold}${_omb_term_violet}========== %s ==========${_omb_term_reset}\n" "$@"; }
_omb_util_command_exists _omb_log_arrow ||
function _omb_log_arrow { printf "➜ %s\n" "$@"; }
_omb_util_command_exists _omb_log_success ||
function _omb_log_success { printf "${_omb_term_green}✔ %s${_omb_term_reset}\n" "$@"; }
_omb_util_command_exists _omb_log_error ||
function _omb_log_error { printf "${_omb_term_brown}✖ %s${_omb_term_reset}\n" "$@"; }
_omb_util_command_exists _omb_log_warning ||
function _omb_log_warning { printf "${_omb_term_olive}➜ %s${_omb_term_reset}\n" "$@"; }
_omb_util_command_exists _omb_log_underline ||
function _omb_log_underline { printf "${_omb_term_underline}${_omb_term_bold}%s${_omb_term_reset}\n" "$@"; }
_omb_util_command_exists _omb_log_bold ||
function _omb_log_bold { printf "${_omb_term_bold}%s${_omb_term_reset}\n" "$@"; }
_omb_util_command_exists _omb_log_note ||
function _omb_log_note { printf "${_omb_term_underline}${_omb_term_bold}${_omb_term_navy}Note:${_omb_term_reset} ${_omb_term_olive}%s${_omb_term_reset}\n" "$@"; }
_omb_util_command_exists _omb_log_info ||
function _omb_log_info { printf "INFO: %s\n" "$1"; }
_omb_util_command_exists _omb_log_die ||
function _omb_log_die { printf 'FATAL: %s\n' "$2"; exit "$1"; }

#
# USAGE FOR SEEKING CONFIRMATION
Expand Down