MCPcopy Create free account
hub / github.com/akash-network/provider / TestNonStringModuleKeyIsNormalized

Function TestNonStringModuleKeyIsNormalized

tools/logging/logger_test.go:227–239  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

225type customKey string
226
227func TestNonStringModuleKeyIsNormalized(t *testing.T) {
228 buf := &bytes.Buffer{}
229 l := New(buf, mustConfig(t, "b:debug,*:info", "json", false, "off", false)).
230 With("module", "a").
231 With(customKey("module"), "b")
232
233 l.Debug("m")
234
235 require.Equal(t, 1, strings.Count(buf.String(), `"module"`), buf.String())
236 lines := jsonLines(t, buf)
237 require.Len(t, lines, 1, "module b is at debug level, entry must be emitted")
238 require.Equal(t, "b", lines[0]["module"])
239}

Callers

nothing calls this directly

Calls 8

mustConfigFunction · 0.85
jsonLinesFunction · 0.85
NewFunction · 0.70
customKeyTypeAlias · 0.70
WithMethod · 0.65
DebugMethod · 0.65
StringMethod · 0.65
LenMethod · 0.45

Tested by

no test coverage detected