refactor(logging): move logging setup to internal/logging
All checks were successful
CI / Lint (pull_request) Successful in 5s
CI / Test (pull_request) Successful in 7s
CI / Build (pull_request) Successful in 7s
CI / Docker Build (pull_request) Successful in 21s

Moves logging configuration and setup to a dedicated package. Updates Config struct to use nested LoggingConfig. Updates main.go to use the new logging package.
This commit is contained in:
Gemini CLI
2026-01-15 18:57:01 +00:00
parent ec689c6152
commit 4807edd23a
6 changed files with 101 additions and 58 deletions

View File

@@ -11,6 +11,7 @@ import (
"time"
"github.com/placeholder/golang-template/internal/config"
"github.com/placeholder/golang-template/internal/logging"
)
func main() {
@@ -27,11 +28,9 @@ func main() {
}
// Setup Logger
opts := &slog.HandlerOptions{
Level: config.ParseLogLevel(cfg.LogLevel),
}
logger := slog.New(slog.NewJSONHandler(os.Stdout, opts))
slog.SetDefault(logger)
logging.Configure(logging.Config{
Level: cfg.Logging.Level,
})
ctx, cancel := context.WithCancel(context.Background())
defer cancel()