-
Notifications
You must be signed in to change notification settings - Fork 92
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
Add flag to log requests at info level #236
Add flag to log requests at info level #236
Conversation
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.
Wanted to leave some preliminary feedback until maintainers chime in.
server/server.go
Outdated
@@ -79,6 +79,7 @@ type Config struct { | |||
HTTPMiddleware []middleware.Interface `yaml:"-"` | |||
Router *mux.Router `yaml:"-"` | |||
DoNotAddDefaultHTTPMiddleware bool `yaml:"-"` | |||
LogRequestsAtInfoLevel bool `yaml:"-"` |
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.
My hunch is that it would preferable to place this under LogSourceIPsRegex
alongside the the log-related flags.
Also, we should:
- Add a yaml tag so it can be configured via file
- Update
(cfg *Config).RegisterFlags
to accept aserver.log-requests-at-info-level
flag.
Co-authored-by: Victor Cinaglia <[email protected]>
Thanks for the PR. It’s now calling |
987bba4
to
2a9f7dd
Compare
Thanks for the the review @bboreham, let me know what you think about the refactor. Another option would be to add another global convenience function that takes a |
What I meant was: call Lines 23 to 38 in 933588f
|
Thanks @bboreham, I see what you meant now! |
Looks better now, thanks. Have you tried it? |
Yep, enabled it for a service running locally and the requests logs are showing at the info level. |
Adds an optional flag to log requests at the info level, still defaulting to logging requests at the debug level.