Refactor all scripts to use common.sh for consistent colored logging

- Update restore.sh to use common.sh instead of inline log function
- Update update.sh to use common.sh instead of inline log function
- Update recover.sh to use common.sh instead of inline log function
- Update check-health.sh to import colors from common.sh

Benefits:
- DRY principle: color definitions in one place
- Consistent logging across all scripts
- Easier maintenance: change log format once
- All scripts now have colored output in terminal
- Reduced code duplication (48 lines removed)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
BeauTroll
2025-12-17 19:26:47 +01:00
parent 58bc9a47cc
commit f3c74de015
4 changed files with 28 additions and 48 deletions

View File

@@ -8,21 +8,15 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
cd "$PROJECT_ROOT"
# Configuration des logs
LOG_DIR="./logs"
LOG_FILE="$LOG_DIR/recover_$(date +%Y%m%d_%H%M%S).log"
# Créer le dossier de logs
mkdir -p "$LOG_DIR"
# Fonction de logging
log() {
local level="$1"
shift
local message="$*"
local timestamp
timestamp=$(date '+%Y-%m-%d %H:%M:%S')
echo "[$timestamp] [$level] $message" | tee -a "$LOG_FILE"
}
# Charger les fonctions communes (log avec couleurs)
# shellcheck disable=SC1091
source "$SCRIPT_DIR/common.sh"
log "INFO" "=== Script de récupération Nextcloud ==="
log "INFO" "Log file: $LOG_FILE"