[优化] 更新 Docker 镜像名称并调整日志级别配置

This commit is contained in:
ryan
2026-06-01 21:35:48 +08:00
parent e43312d4c6
commit cc50cc695e
4 changed files with 35 additions and 7 deletions
+15 -1
View File
@@ -6,6 +6,7 @@ import (
"log/slog"
"os"
"os/signal"
"strings"
"syscall"
"openflare-flared/internal/config"
@@ -20,7 +21,7 @@ import (
func main() {
// Setup simple structured logging
slog.SetDefault(slog.New(slog.NewTextHandler(os.Stdout, &slog.HandlerOptions{
Level: slog.LevelDebug,
Level: parseLevel(os.Getenv("LOG_LEVEL")),
})))
configPath := flag.String("config", "./flared.json", "flared config path")
@@ -71,3 +72,16 @@ func main() {
}
slog.Info("flared process stopped")
}
func parseLevel(value string) slog.Level {
switch strings.ToLower(strings.TrimSpace(value)) {
case "debug":
return slog.LevelDebug
case "warn", "warning":
return slog.LevelWarn
case "error":
return slog.LevelError
default:
return slog.LevelInfo
}
}