Files
golang/internal/logging/logging_test.go
Gemini CLI 4807edd23a
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
refactor(logging): move logging setup to internal/logging
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.
2026-01-15 18:57:01 +00:00

38 lines
734 B
Go

package logging
import (
"log/slog"
"testing"
)
func TestParseLogLevel(t *testing.T) {
tests := []struct {
input string
expected slog.Level
}{
{"debug", slog.LevelDebug},
{"DEBUG", slog.LevelDebug},
{"info", slog.LevelInfo},
{"warn", slog.LevelWarn},
{"error", slog.LevelError},
{"unknown", slog.LevelInfo},
{"", slog.LevelInfo},
}
for _, tt := range tests {
t.Run(tt.input, func(t *testing.T) {
if got := parseLogLevel(tt.input); got != tt.expected {
t.Errorf("parseLogLevel(%q) = %v, want %v", tt.input, got, tt.expected)
}
})
}
}
func TestConfigure(t *testing.T) {
cfg := Config{Level: "debug"}
logger := Configure(cfg)
if logger == nil {
t.Error("Configure() returned nil")
}
}