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:
parent
7d4e6a5871
commit
29f554915e
1 changed files with 11 additions and 7 deletions
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue