-
Notifications
You must be signed in to change notification settings - Fork 71
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
Finish switching to use slog for logging #660
Conversation
Codecov Report
@@ Coverage Diff @@
## main #660 +/- ##
==========================================
+ Coverage 74.04% 74.31% +0.27%
==========================================
Files 100 99 -1
Lines 13177 13129 -48
==========================================
Hits 9757 9757
+ Misses 2732 2684 -48
Partials 688 688 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
08c0de8
to
1735228
Compare
defer sentry.Flush(2 * time.Second) | ||
|
||
logger = slog.New( | ||
slogmulti.Fanout( |
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.
We need to use multi handlers here so that we can log the error both to sentry and the text logs on the servers
cmd/courier/main.go
Outdated
@@ -87,51 +89,61 @@ func main() { | |||
} | |||
|
|||
// configure our logger | |||
logrus.SetOutput(os.Stdout) | |||
level, err := logrus.ParseLevel(config.LogLevel) | |||
loggerLevel := new(slog.LevelVar) |
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.
do we need this? or can we just parse the Level
value and then create the handler?
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.
using the levelVar is the only approach to support later changing the log level, but we change to use the parsed level and create a new handler.
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.
Woohoo!
Removes logrus use and add sentry handler for slog