fix(level-guesser): recognize "Information" as info level (#4833)

This commit is contained in:
TowyTowy
2026-07-15 15:01:05 +02:00
committed by GitHub
parent 237e916390
commit 63fa7c9e04
2 changed files with 15 additions and 1 deletions
+1 -1
View File
@@ -15,7 +15,7 @@ var SupportedLogLevels map[string]struct{}
var logLevels = [][]string{
{"error", "err"},
{"warn", "warning", "wrn"},
{"info", "inf"},
{"info", "inf", "information"},
{"debug", "dbg"},
{"trace", "verbose", "ver", "vbs"},
{"fatal", "sev", "severe", "crit", "critical"},
+14
View File
@@ -115,6 +115,20 @@ func TestGuessLogLevel(t *testing.T) {
{"WARN: connection error: retrying", "warn"},
// Symmetric: an ERROR prefix still wins over a later info word.
{"ERROR: handler failed, info: will retry", "error"},
// .NET / Serilog / Microsoft.Extensions.Logging spell out "Information".
{"Information: service started", "info"},
{"[Information] service started", "info"},
{"2024-12-30T17:43:16Z Information starting up", "info"},
{orderedmap.New[string, string](
orderedmap.WithInitialData(
orderedmap.Pair[string, string]{Key: "level", Value: "Information"},
),
), "info"},
{orderedmap.New[string, any](
orderedmap.WithInitialData(
orderedmap.Pair[string, any]{Key: "@l", Value: "Information"},
),
), "info"},
// Equal confidence between two different levels -> unknown (don't guess).
{"saw info: here and error: there", "unknown"},
{"[INFO] [DEBUG] both bracketed", "unknown"},