MCPcopy
hub / github.com/gofiber/fiber / Test_DefaultFormatLogger

Function Test_DefaultFormatLogger

log/default_test.go:189–211  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

187}
188
189func Test_DefaultFormatLogger(t *testing.T) {
190 initDefaultLogger()
191
192 var w byteSliceWriter
193 SetOutput(&w)
194
195 Tracef("trace %s", work)
196 Debugf("received %s order", work)
197 Infof("starting %s", work)
198 Warnf("%s may fail", work)
199 Errorf("%s failed", work)
200
201 require.Panics(t, func() {
202 Panicf("%s panic", work)
203 })
204
205 require.Equal(t, "[Trace] trace work\n"+
206 "[Debug] received work order\n"+
207 "[Info] starting work\n"+
208 "[Warn] work may fail\n"+
209 "[Error] work failed\n"+
210 "[Panic] work panic\n", string(w.b))
211}
212
213func Test_CtxLogger(t *testing.T) {
214 initDefaultLogger()

Callers

nothing calls this directly

Calls 8

initDefaultLoggerFunction · 0.85
SetOutputFunction · 0.85
TracefFunction · 0.85
DebugfFunction · 0.85
InfofFunction · 0.85
WarnfFunction · 0.85
ErrorfFunction · 0.85
PanicfFunction · 0.85

Tested by

no test coverage detected