feat: update print function

This commit is contained in:
2025-07-30 10:32:30 +02:00
parent ef4b24a200
commit a9fa8e1e4f
3 changed files with 44 additions and 52 deletions

View File

@@ -8,10 +8,19 @@ LOG="/var/log/$FILENAME.log"
DATETIME_FORMAT="%d-%m-%Y %H:%M:%S"
datetime_print() {
info_print() {
local message="$1"
local level="${2:-INFO}"
local level="${2:-1}"
local timestamp="[$(date +"$DATETIME_FORMAT")]"
case $level in
1) local level="\e[34mINFO\e[0m";;
2) local level="\e[33mWARN\e[0m";;
3) local level="\e[31mERROR\e[0m";;
4) local level="\e[35mDEBUG\e[0m";;
5) local level="\e[36mACTION\e[0m";;
*);;
esac
echo -e "$timestamp - $level: $message" | tee -a "$LOG"
}