-
Notifications
You must be signed in to change notification settings - Fork 910
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Port previous NewTestLogger flags over #7432
base: main
Are you sure you want to change the base?
Port previous NewTestLogger flags over #7432
Conversation
3f2149b
to
ea29fc2
Compare
func WithoutCaller() LoggerOption { | ||
return func(t *TestLogger) { | ||
t.state.logCaller = false | ||
} | ||
} | ||
|
||
func LogCaller() LoggerOption { | ||
return func(t *TestLogger) { | ||
t.state.logCaller = false | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't work together with log.BuildZapLogger
which defaults to disabling this. Removing it for now.
@@ -55,13 +56,13 @@ var _ Logger = (*zapLogger)(nil) | |||
|
|||
// NewTestLogger returns a logger for tests | |||
func NewTestLogger() *zapLogger { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a ticket to remove this function and replace it with testlogger.TestLogger.
ea29fc2
to
1269009
Compare
if format == "" { | ||
format = "console" | ||
} | ||
|
||
logger := BuildZapLogger(Config{ | ||
Level: os.Getenv(testLogLevelEnvVar), | ||
Level: os.Getenv(TestLogLevelEnvVar), | ||
Format: format, | ||
Development: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we port this too? it looks like it controls whether it panics on dpanic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new TestLogger already has a flag panicOnDPanic
which by default is true
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need envs to control test logger? Do we use it anywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
David does to switch it to JSON format; and I noticed that I actually set up my IDE to log on error level instead of debug level. So that's two use cases already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't know we have it.
What changed?
Ports
TEMPORAL_TEST_LOG_FORMAT
andTEMPORAL_TEST_LOG_LEVEL
to testlogger.TestLogger.Why?
To not break developer setups.
How did you test it?
Potential risks
Documentation
Is hotfix candidate?