feat: set process-wide default logger for discord-bot
All checks were successful
CI / test (push) Successful in 4s
CI / build-ha-gateway (push) Successful in 59s
CI / build-discord-bot (push) Successful in 48s

This commit is contained in:
Nik Afiq 2026-04-09 06:09:44 +09:00
parent 551a38db24
commit c918c8674a

View File

@ -2,6 +2,7 @@ package main
import ( import (
"context" "context"
"log/slog"
"os" "os"
"os/signal" "os/signal"
"syscall" "syscall"
@ -31,6 +32,9 @@ func main() {
} }
log := logger.New(cfg.LogFormat, cfg.LogLevel) log := logger.New(cfg.LogFormat, cfg.LogLevel)
// Set the process-wide default so contexts created at library boundaries
// still inherit the configured JSON/text handler.
slog.SetDefault(log)
log.Info("starting discord-bot", log.Info("starting discord-bot",
"version", version, "version", version,
"ha_gateway_addr", cfg.HAGatewayAddr, "ha_gateway_addr", cfg.HAGatewayAddr,