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

Function TestInfoLogging

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

Source from the content-addressed store, hash-verified

139}
140
141func TestInfoLogging(t *testing.T) {
142 buffer := logtest.NewDefaultTestLogBuffer()
143
144 logger, err := log.NewDefaultLoggerFactory().Create(
145 log.WithOutputWriter(buffer),
146 log.WithLevel(zerolog.InfoLevel),
147 )
148 assert.NoError(t, err)
149
150 echoLogger := httpserver.NewEchoLogger(logger)
151
152 echoLogger.Info("test regular message")
153 logtest.AssertHasLogRecord(t, buffer, map[string]interface{}{
154 "level": "info",
155 "message": "test regular message",
156 })
157
158 echoLogger.Infof("test placeholder message: %s", "placeholder")
159 logtest.AssertHasLogRecord(t, buffer, map[string]interface{}{
160 "level": "info",
161 "message": "test placeholder message: placeholder",
162 })
163
164 echoLogger.Infoj(echologger.JSON{"message": "test json message"})
165 logtest.AssertHasLogRecord(t, buffer, map[string]interface{}{
166 "level": "info",
167 "message": "test json message",
168 })
169}
170
171func TestWarnLogging(t *testing.T) {
172 buffer := logtest.NewDefaultTestLogBuffer()

Callers

nothing calls this directly

Calls 4

InfoMethod · 0.95
InfofMethod · 0.95
InfojMethod · 0.95
CreateMethod · 0.65

Tested by

no test coverage detected