Skip to content

Instantly share code, notes, and snippets.

@killbus
Created February 9, 2021 10:48
Show Gist options
  • Save killbus/bf2b6648e8398c336938689a3c953d9b to your computer and use it in GitHub Desktop.
Save killbus/bf2b6648e8398c336938689a3c953d9b to your computer and use it in GitHub Desktop.
#!/bin/bash
PROGRAM_NAME="$(basename "${0}")"
logdate() {
date "+%Y-%m-%d %H:%M:%S"
}
log() {
local status="${1}"
shift
echo >&2 "$(logdate): ${PROGRAM_NAME}: ${status}: ${*}"
}
warning() {
log WARNING "${@}"
}
error() {
log ERROR "${@}"
}
info() {
log INFO "${@}"
}
fatal() {
log FATAL "${@}"
exit 1
}
info "test"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment