MCPcopy Create free account
hub / github.com/ankorstore/yokai / TestDebugLogging

Function TestDebugLogging

httpserver/logger_test.go:111–139  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

109}
110
111func TestDebugLogging(t *testing.T) {
112 buffer := logtest.NewDefaultTestLogBuffer()
113
114 logger, err := log.NewDefaultLoggerFactory().Create(
115 log.WithOutputWriter(buffer),
116 log.WithLevel(zerolog.DebugLevel),
117 )
118 assert.NoError(t, err)
119
120 echoLogger := httpserver.NewEchoLogger(logger)
121
122 echoLogger.Debug("test regular message")
123 logtest.AssertHasLogRecord(t, buffer, map[string]interface{}{
124 "level": "debug",
125 "message": "test regular message",
126 })
127
128 echoLogger.Debugf("test placeholder message: %s", "placeholder")
129 logtest.AssertHasLogRecord(t, buffer, map[string]interface{}{
130 "level": "debug",
131 "message": "test placeholder message: placeholder",
132 })
133
134 echoLogger.Debugj(echologger.JSON{"message": "test json message"})
135 logtest.AssertHasLogRecord(t, buffer, map[string]interface{}{
136 "level": "debug",
137 "message": "test json message",
138 })
139}
140
141func TestInfoLogging(t *testing.T) {
142 buffer := logtest.NewDefaultTestLogBuffer()

Callers

nothing calls this directly

Calls 4

DebugMethod · 0.95
DebugfMethod · 0.95
DebugjMethod · 0.95
CreateMethod · 0.65

Tested by

no test coverage detected