From 50fccc03ab69d37589a9c160393e8cd6188f9219 Mon Sep 17 00:00:00 2001 From: DragonSlayer_14 Date: Mon, 3 Mar 2025 22:34:30 +0100 Subject: [PATCH] =?UTF-8?q?Feat:=20F=C3=BCgt=20Log-Nachrichten=20in=20eine?= =?UTF-8?q?=20Log-Datei=20hinzu.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Utility/Log.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Utility/Log.sh b/Utility/Log.sh index 7f0b0fa..c24c946 100755 --- a/Utility/Log.sh +++ b/Utility/Log.sh @@ -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" }