You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
629 B
41 lines
629 B
#!/usr/bin/env bash |
|
|
|
# exec &> >(tee -a "${SYSLOG}") |
|
# exec &> >(tee -a "${APPLOG}") |
|
|
|
trap 'exit 1' HUP INT QUIT TERM |
|
|
|
log::prefix() { |
|
date=$(gdate '+%Y-%m-%d %H:%M:%S,%3N') |
|
printf '%s %s\n' "${date}" "${*}" |
|
} |
|
|
|
log::notice() { |
|
log::info "==> ${*}" |
|
} |
|
|
|
log::info() { |
|
log::prefix "INFO ${*}" |
|
} |
|
|
|
log::debug() { |
|
log::prefix "DEBUG ${*}" |
|
} |
|
|
|
log::warning() { |
|
log::prefix "WARNING ${*}" |
|
} |
|
|
|
log::error() { |
|
log::prefix "ERROR ${*}" >&2 |
|
} |
|
|
|
log::fatal() { |
|
reason='Unknown or not specified' |
|
if [ "$1" ]; then |
|
reason=$1 |
|
fi |
|
log::error "Fatal error. Reason: ${reason}" |
|
kill -s TERM $$ |
|
} |
|
|
|
|