feat: add bds core, locale updates and safety fixes
This commit is contained in:
38
lib/logger.sh
Normal file
38
lib/logger.sh
Normal file
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
log() {
|
||||
local level="$1"
|
||||
shift
|
||||
printf '[%s] [%s] %s\n' "$(date +'%Y-%m-%d %H:%M:%S')" "$level" "$*"
|
||||
}
|
||||
|
||||
info() {
|
||||
log "INFO" "$@"
|
||||
}
|
||||
|
||||
warn() {
|
||||
log "WARN" "$@"
|
||||
}
|
||||
|
||||
error() {
|
||||
log "ERROR" "$@"
|
||||
}
|
||||
|
||||
debug() {
|
||||
if [[ "${DEBUG:-no}" == "yes" ]]; then
|
||||
log "DEBUG" "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
fail() {
|
||||
error "$@"
|
||||
exit 1
|
||||
}
|
||||
|
||||
run_cmd() {
|
||||
if [[ "${DRY_RUN:-no}" == "yes" ]]; then
|
||||
info "[dry-run] $*"
|
||||
return 0
|
||||
fi
|
||||
"$@"
|
||||
}
|
||||
Reference in New Issue
Block a user