1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-04 17:24:45 +00:00

Support debug

This commit is contained in:
Tw93
2025-12-05 17:16:46 +08:00
parent 5761fd87c8
commit b939442e92
11 changed files with 160 additions and 30 deletions

View File

@@ -328,6 +328,13 @@ log_error() {
echo "[$(date '+%Y-%m-%d %H:%M:%S')] ERROR: $1" >> "$LOG_FILE" 2> /dev/null || true
}
# Debug logging - only shown when MO_DEBUG=1
debug_log() {
if [[ "${MO_DEBUG:-}" == "1" ]]; then
echo -e "${GRAY}[DEBUG]${NC} $*" >&2
fi
}
# Run command with optional error handling
# Usage: run_silent command args... # Ignore errors
# run_logged command args... # Log errors but continue