Skip to content

Commit f105fbe

Browse files
committed
Log the 'log.logger' key
1 parent ab36659 commit f105fbe

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

logp/logptest/logger.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,12 @@ type Logger struct {
6060
// replacement for a *logp.Logger, or the logger can be accessed via
6161
// [Logger.Logger]
6262
func NewFileLogger(t testing.TB, dir string) *Logger {
63-
encoderConfig := ecszap.ECSCompatibleEncoderConfig(zapcore.EncoderConfig{})
63+
encoderConfig := ecszap.ECSCompatibleEncoderConfig(zapcore.EncoderConfig{
64+
// As long as NameKey is NOT EMPTY it will be overridden
65+
// by the correct key. So we set it to 'enabled' to make it very
66+
// clear this is NOT the final key for the logger name.
67+
NameKey: "enabled",
68+
})
6469
encoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
6570
encoder := zapcore.NewJSONEncoder(encoderConfig)
6671

0 commit comments

Comments
 (0)