MCPcopy Create free account
hub / github.com/prometheus/common / getLogEntryLevelCounts

Function getLogEntryLevelCounts

promslog/slog_test.go:83–95  ·  view source on GitHub ↗
(s string, re *regexp.Regexp)

Source from the content-addressed store, hash-verified

81}
82
83func getLogEntryLevelCounts(s string, re *regexp.Regexp) map[string]int {
84 counters := make(map[string]int)
85 for line := range strings.SplitSeq(s, "\n") {
86 matches := re.FindStringSubmatch(line)
87 if len(matches) > 1 {
88 levelIndex := re.SubexpIndex("LevelValue")
89
90 counters[strings.ToLower(matches[levelIndex])]++
91 }
92 }
93
94 return counters
95}
96
97func TestDurationValues(t *testing.T) {
98 dur, err := time.ParseDuration("1m30s")

Callers 1

TestDynamicLevelsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected