logging functions and color variables

This commit is contained in:
sometimesuseful 2024-11-12 14:14:25 +00:00
parent 66c2231a15
commit e4bce4beef
2 changed files with 28 additions and 0 deletions

6
modules/colors.sh Normal file
View file

@ -0,0 +1,6 @@
#!/bin/bash
# Color variables for logging.
RESET="\033[0m"
GREEN="\033[1;32m"
RED="\033[1;31m"

22
modules/functions.sh Normal file
View file

@ -0,0 +1,22 @@
#!/bin/bash
# Common utility functions shared across multiple files.
source colors.sh
check_dependencies() {
return 0
}
log_info() {
local caller="${0##*/}"
echo -e "$caller: INFO: $*" >&2
}
log_notice() {
local caller="${0##*/}"
echo -e "$caller: ${GREEN}NOTICE: $*${RESET}" >&2
}
log_err() {
local caller="${0##*/}"
echo -e "$caller: ${RED}ERROR: $*${RESET}" >&2
}