| 225 | type customKey string |
| 226 | |
| 227 | func 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 | } |