(s string, re *regexp.Regexp)
| 81 | } |
| 82 | |
| 83 | func 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 | |
| 97 | func TestDurationValues(t *testing.T) { |
| 98 | dur, err := time.ParseDuration("1m30s") |