Files
CLIProxyAPI/internal/logging/global_logger_test.go
2026-06-09 11:32:57 +08:00

28 lines
631 B
Go

package logging
import (
"strings"
"testing"
"time"
log "github.com/sirupsen/logrus"
)
func TestLogFormatterPrintsVersionField(t *testing.T) {
entry := log.NewEntry(log.New())
entry.Time = time.Date(2026, 6, 9, 11, 10, 2, 0, time.Local)
entry.Level = log.InfoLevel
entry.Message = "fetched latest antigravity version"
entry.Data["version"] = "2.1.0"
formatted, errFormat := (&LogFormatter{}).Format(entry)
if errFormat != nil {
t.Fatalf("Format() error = %v", errFormat)
}
line := string(formatted)
if !strings.Contains(line, "version=2.1.0") {
t.Fatalf("formatted line %q missing version field", line)
}
}