feat(log): 日志等级

This commit is contained in:
YuleBest committed 2026-04-10 08:23:55 +08:00
1 parent ae42b7f0f2
commit 66ff3a6429
9 files changed
+74 -7

No files matched your search

+7
View File
@@ -36,6 +36,13 @@ get_config_hash() {
_log() {
local level="${2:-INFO}"
local ll
ll="$(get_cfg log_level "info")"
case "$ll" in
off) return ;;
error) case "$level" in ERROR) ;; *) return ;; esac ;;
warn) case "$level" in ERROR | WARN) ;; *) return ;; esac ;;
esac
printf '[%s] [%s] [%s] %s\n' "$(date '+%m-%d %H:%M:%S')" "daemon" "$level" "$1" >>"$log_file"
}