| 197 | } |
| 198 | |
| 199 | func TestLoggerErrorf(t *testing.T) { |
| 200 | for _, tc := range formatTestCases { |
| 201 | tc := tc |
| 202 | tc.level = ErrorLevel |
| 203 | message := fmt.Sprintf(tc.format, tc.args...) |
| 204 | tc.wantedPattern = fmt.Sprintf(`^\[ERR\] %s\n$`, message) |
| 205 | t.Run(tc.description, func(t *testing.T) { |
| 206 | var buf bytes.Buffer |
| 207 | logger := NewLogger(newBase(&buf)) |
| 208 | logger.Errorf(tc.format, tc.args...) |
| 209 | got := buf.String() |
| 210 | assert.Regexp(t, tc.wantedPattern, got) |
| 211 | }) |
| 212 | } |
| 213 | } |
| 214 | |
| 215 | func TestLoggerFatalf(t *testing.T) { |
| 216 | originalOsExit := osExit |