mirror of
https://github.com/RetroDECK/RetroDECK.git
synced 2024-11-25 15:35:38 +00:00
Rearrange logging checks based on verbosity
This commit is contained in:
parent
c8fcabec02
commit
ef9b5024fd
|
@ -40,16 +40,16 @@ log() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "$level" in
|
case "$level" in
|
||||||
w)
|
d)
|
||||||
if [ "$colorize_terminal" = true ]; then
|
if [ "$colorize_terminal" = true ]; then
|
||||||
# Warning (yellow) for terminal
|
# Debug (green) for terminal
|
||||||
colored_message="\e[33m[WARN] $message\e[0m"
|
colored_message="\e[32m[DEBUG] $message\e[0m"
|
||||||
else
|
else
|
||||||
# Warning (no color for sh) for terminal
|
# Debug (no color for sh) for terminal
|
||||||
colored_message="$timestamp [WARN] $message"
|
colored_message="$timestamp [DEBUG] $message"
|
||||||
fi
|
fi
|
||||||
# Write to log file without colorization
|
# Write to log file without colorization
|
||||||
log_message="$timestamp [WARN] $message"
|
log_message="$timestamp [DEBUG] $message"
|
||||||
;;
|
;;
|
||||||
e)
|
e)
|
||||||
if [ "$colorize_terminal" = true ]; then
|
if [ "$colorize_terminal" = true ]; then
|
||||||
|
@ -62,22 +62,22 @@ log() {
|
||||||
# Write to log file without colorization
|
# Write to log file without colorization
|
||||||
log_message="$timestamp [ERROR] $message"
|
log_message="$timestamp [ERROR] $message"
|
||||||
;;
|
;;
|
||||||
|
w)
|
||||||
|
if [ "$colorize_terminal" = true ]; then
|
||||||
|
# Warning (yellow) for terminal
|
||||||
|
colored_message="\e[33m[WARN] $message\e[0m"
|
||||||
|
else
|
||||||
|
# Warning (no color for sh) for terminal
|
||||||
|
colored_message="$timestamp [WARN] $message"
|
||||||
|
fi
|
||||||
|
# Write to log file without colorization
|
||||||
|
log_message="$timestamp [WARN] $message"
|
||||||
|
;;
|
||||||
i)
|
i)
|
||||||
# Write to log file without colorization for info message
|
# Write to log file without colorization for info message
|
||||||
log_message="$timestamp [INFO] $message"
|
log_message="$timestamp [INFO] $message"
|
||||||
colored_message=$log_message
|
colored_message=$log_message
|
||||||
;;
|
;;
|
||||||
d)
|
|
||||||
if [ "$colorize_terminal" = true ]; then
|
|
||||||
# Debug (green) for terminal
|
|
||||||
colored_message="\e[32m[DEBUG] $message\e[0m"
|
|
||||||
else
|
|
||||||
# Debug (no color for sh) for terminal
|
|
||||||
colored_message="$timestamp [DEBUG] $message"
|
|
||||||
fi
|
|
||||||
# Write to log file without colorization
|
|
||||||
log_message="$timestamp [DEBUG] $message"
|
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
# Default (no color for other shells) for terminal
|
# Default (no color for other shells) for terminal
|
||||||
colored_message="$timestamp $message"
|
colored_message="$timestamp $message"
|
||||||
|
@ -86,7 +86,6 @@ log() {
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
||||||
# Display the message in the terminal
|
# Display the message in the terminal
|
||||||
echo -e "$colored_message" >&2
|
echo -e "$colored_message" >&2
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue