bpkg-log
bpkg-log
Structured, levelled logging for bash with colored terminal output and optional file sink.
Installation
bpkg install bpkg/bpkg-log
Usage
source bpkg_modules/bpkg-log/bpkg-log.sh
log_info "Server started on port 8080"
log_warn "Disk usage above 80%"
log_error "Connection refused"
log_debug "Variable x = $x"
Configuration
| Variable | Default | Description |
|---|---|---|
LOG_LEVEL |
info |
Minimum level to output |
LOG_FILE |
(none) | Path to write logs to |
LOG_COLOR |
1 |
Set to 0 to disable colors |
Levels
debug < info < warn < error < fatal