zabbix/templates/entrypoints/lib/logging.sh
2026-04-13 21:28:21 +09:00

22 lines
288 B
Bash

# shellcheck shell=bash
timestamp() {
date -u '+%Y-%m-%dT%H:%M:%SZ'
}
log() {
local type="$1"
shift
printf '%s [%s]: %s\n' "$(timestamp)" "$type" "$*"
}
info() {
log "info" "$@"
}
warn() {
log "warning" "$@" >&2
}
error() {
log "error" "$@" >&2
exit 1
}