mirror of
https://github.com/mudler/LocalAI.git
synced 2025-05-25 21:15:00 +00:00
feat: Enhance log functions with ANSI color formatting
- Added ANSI escape codes for improved log styling: light blue for info, orange for warnings, and red for errors. - Updated all log functions (`info`, `warn`, `fatal`) to include bold and colored output. Signed-off-by: Alessandro Pirastru <alessandro.pirastru.94@gmail.com>
This commit is contained in:
parent
f00029ddba
commit
979f666fc1
1 changed files with 10 additions and 3 deletions
13
docs/static/install.sh
vendored
13
docs/static/install.sh
vendored
|
@ -31,19 +31,26 @@ set -o noglob
|
|||
#set -x
|
||||
|
||||
# --- helper functions for logs ---
|
||||
# ANSI escape codes
|
||||
LIGHT_BLUE='\033[38;5;117m'
|
||||
ORANGE='\033[38;5;214m'
|
||||
RED='\033[38;5;196m'
|
||||
BOLD='\033[1m'
|
||||
RESET='\033[0m'
|
||||
|
||||
info()
|
||||
{
|
||||
echo ' ' "$@"
|
||||
echo -e "${BOLD}${LIGHT_BLUE}" '[INFO] ' "$@" "${RESET}"
|
||||
}
|
||||
|
||||
warn()
|
||||
{
|
||||
echo '[WARN] ' "$@" >&2
|
||||
echo -e "${BOLD}${ORANGE}" '[WARN] ' "$@" "${RESET}" >&2
|
||||
}
|
||||
|
||||
fatal()
|
||||
{
|
||||
echo '[ERROR] ' "$@" >&2
|
||||
echo -e "${BOLD}${RED}" '[ERROR] ' "$@" "${RESET}" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue