mirror of
https://github.com/guezoloic/serverconfig.git
synced 2026-01-25 07:34:23 +00:00
feat: update print function
This commit is contained in:
@@ -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"
|
||||
}
|
||||
Reference in New Issue
Block a user