-
Notifications
You must be signed in to change notification settings - Fork 6
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
improve slogtest #13
improve slogtest #13
Conversation
Also removing trailing newlines so logs go from this:
to this
|
Drive-by observation - This is coming from the testing package, not slog (https://cs.opensource.google/go/go/+/refs/tags/go1.22.0:src/testing/testing.go;l=1010). Setting
|
Signed-off-by: Jason Hall <[email protected]>
Signed-off-by: Jason Hall <[email protected]>
Signed-off-by: Jason Hall <[email protected]>
Signed-off-by: Jason Hall <[email protected]>
Signed-off-by: Jason Hall <[email protected]>
Signed-off-by: Jason Hall <[email protected]>
I've updated this PR to not use This deprecates |
|
||
// TestLogger gets a logger to use in unit and end to end tests. | ||
// This logger is configured to log at debug level. | ||
func TestLogger(t Logger) *clog.Logger { | ||
return TestLoggerWithOptions(t, &slog.HandlerOptions{ | ||
Level: slog.LevelDebug, |
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.
keep this? IIRC this lets debug logs surface in test output (which follows the regular go test
pattern where they only show if the test fails).
#13 (comment) Signed-off-by: Jason Hall <[email protected]>
Without the slogtest change, with the newly added test:
With this change: