Improve logging and error handling with session IDs

Introduces a SESSION_ID variable for log file naming and tracking, updates log file paths to include timestamps and session IDs, and enhances error handling output to use custom message functions when available. Also improves log file management and user guidance for viewing logs, and refactors error handler to better support containerized environments.
This commit is contained in:
CanbiZ
2025-11-04 16:59:02 +01:00
parent a6cdb474a1
commit b55e8f5f34
3 changed files with 144 additions and 105 deletions

View File

@@ -27,7 +27,8 @@ variables() {
DIAGNOSTICS="yes" # sets the DIAGNOSTICS variable to "yes", used for the API call.
METHOD="default" # sets the METHOD variable to "default", used for the API call.
RANDOM_UUID="$(cat /proc/sys/kernel/random/uuid)" # generates a random UUID and sets it to the RANDOM_UUID variable.
CTTYPE="${CTTYPE:-${CT_TYPE:-1}}"
SESSION_ID="${RANDOM_UUID:0:8}" # Short session ID (first 8 chars of UUID) for log files
CTTYPE="${CTTYPE:-${CT_TYPE:-1}}"}
# Get Proxmox VE version and kernel version
if command -v pveversion >/dev/null 2>&1; then
@@ -2144,6 +2145,7 @@ build_container() {
fi
export DIAGNOSTICS="$DIAGNOSTICS"
export RANDOM_UUID="$RANDOM_UUID"
export SESSION_ID="$SESSION_ID"
export CACHER="$APT_CACHER"
export CACHER_IP="$APT_CACHER_IP"
export tz="$timezone"