pound-emu_pound/scripts/log.sh
Ronald Caesar 6bdfd6fcea
Big Commit
The changes affects multiple places in the repo and this one of the rare
instances where I cant be bothered writing a comprehensive commit. Look
at the diff for changes.

Signed-off-by: Ronald Caesar <github43132@proton.me>
2025-09-27 09:16:49 -04:00

28 lines
645 B
Bash

#!bin/bash
# Error handling function
error_handler() {
local exit_code=$?
local line_number=$1
log_critical "Script exited with code $exit_code at line $line_number"
log_critical "ABORT: Submodule setup failed - SYSTEM IN UNSTABLE STATE"
cleanup_on_failure
exit $exit_code
}
trap 'error_handler $LINENO' ERR
# Logging system
log() {
local level=$1
shift
local message="$*"
local timestamp=$(date '+%Y-%m-%d %H:%M:%S')
echo "[$timestamp] [$level] $message"
}
log_info() { log "INFO" "$*"; }
log_warn() { log "WARN" "$*"; }
log_error() { log "ERROR" "$*"; }
log_critical() { log "CRITICAL" "$*"; }