Feat: Fügt Log-Nachrichten in eine Log-Datei hinzu.

This commit is contained in:
DragonSlayer_14 2025-03-03 22:34:30 +01:00
parent af5417c175
commit 50fccc03ab

View File

@ -1,6 +1,14 @@
#!/bin/bash
# === Variablen ===
LOGDIR="/tmp/skript-logs"
LOGFILE="$LOGDIR/$(basename "$0" .sh)_$(date +'%Y-%m-%d').log"
# Funktion zum Protokollieren von Nachrichten
log() {
echo "$(date +'%Y-%m-%d %H:%M:%S') - $1"
if [ ! -d "$LOGDIR" ]; then
mkdir -p "$LOGDIR"
fi
echo "$(date +'%Y-%m-%d %H:%M:%S') - $1" | tee -a "$LOGFILE"
}