MCPcopy Create free account
hub / github.com/devnullvoid/pvetui / TestLogger_ErrorLevel

Function TestLogger_ErrorLevel

internal/logger/logger_test.go:310–331  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

308}
309
310func TestLogger_ErrorLevel(t *testing.T) {
311 var buf bytes.Buffer
312 config := &Config{
313 Level: LevelError,
314 Output: &buf,
315 }
316
317 logger, err := NewLogger(config)
318 require.NoError(t, err)
319 defer logger.Close()
320
321 // Only error messages should be logged
322 logger.Debug("debug message")
323 logger.Info("info message")
324 logger.Error("error message")
325
326 output := buf.String()
327 assert.NotContains(t, output, "[DEBUG]")
328 assert.NotContains(t, output, "[INFO]")
329 assert.Contains(t, output, "[ERROR]")
330 assert.Contains(t, output, "error message")
331}
332
333func TestLogger_FormatMessage(t *testing.T) {
334 var buf bytes.Buffer

Callers

nothing calls this directly

Calls 6

CloseMethod · 0.95
DebugMethod · 0.95
InfoMethod · 0.95
ErrorMethod · 0.95
NewLoggerFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected