Logging should go to stderr

Also added "fatal" alias to fail and applied shfmt

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2018-10-07 14:41:29 +02:00
parent 7d4e6a5871
commit 29f554915e
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E

View file

@ -5,26 +5,30 @@ COLOR_YELLOW="\033[0;33m"
COLOR_PLAIN="\033[0m" COLOR_PLAIN="\033[0m"
function error() { function error() {
echo -e "${COLOR_RED}$@${COLOR_PLAIN}" echo -e "${COLOR_RED}$@${COLOR_PLAIN}" >&2
} }
function fail() { function fail() {
error "$@" error "$@"
exit 1 exit 1
}
function fatal() {
fail "$@"
} }
function info() { function info() {
echo -e "${COLOR_CYAN}$@${COLOR_PLAIN}" echo -e "${COLOR_CYAN}$@${COLOR_PLAIN}" >&2
} }
function step() { function step() {
info "[$(date +%H:%M:%S)] $@" info "[$(date +%H:%M:%S)] $@"
} }
function success() { function success() {
echo -e "${COLOR_GREEN}$@${COLOR_PLAIN}" echo -e "${COLOR_GREEN}$@${COLOR_PLAIN}" >&2
} }
function warn() { function warn() {
echo -e "${COLOR_YELLOW}$@${COLOR_PLAIN}" echo -e "${COLOR_YELLOW}$@${COLOR_PLAIN}" >&2
} }