orcli/src/lib/logging.sh

16 lines
372 B
Bash
Raw Normal View History

2022-04-12 18:26:43 +02:00
# print messages to STDERR
# shellcheck shell=bash
function error() {
echo >&2 "[$(date +'%Y-%m-%dT%H:%M:%S')] ERROR: $1"
shift
2022-04-20 12:27:53 +02:00
for msg in "$@"; do echo >&2 " $msg"; done
2022-04-12 18:26:43 +02:00
exit 1
}
function log() {
2022-11-14 23:46:18 +01:00
if ! [[ ${args[--quiet]} || $ORCLI_QUIET ]]; then
2022-04-20 12:27:53 +02:00
echo >&2 "[$(date +'%Y-%m-%dT%H:%M:%S')] $1"
shift
for msg in "$@"; do echo >&2 " $msg"; done
fi
2022-04-12 18:26:43 +02:00
}