-
Notifications
You must be signed in to change notification settings - Fork 56
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
Update logging formatting/encoder #547
Conversation
} | ||
|
||
func ZapLogFormatter(_ io.Writer, params handlers.LogFormatterParams) { | ||
L.Debug("handled request", |
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.
good change moving this to debug
LevelKey: "level", | ||
EncodeLevel: zapcore.CapitalColorLevelEncoder, | ||
|
||
TimeKey: "time", |
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.
Is the time necessary for terminal errors?
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.
It's probably not but I find the log line without timestamp looks awkward:
$ infra version
WARN Infra CLI (v0.3.6-next) is out of date. Please update to 0.3.6.
vs.
$ infra version
2021-10-28T13:58:08.750-0700 WARN Infra CLI (v0.3.6-next) is out of date. Please update to 0.3.6.
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.
Another thing is while we don't have long lived commands in Infra CLI right now, it may be the case in the future where timestamps will be useful, e.g. running admin API commands.
Follow up in #549 |
gorilla/handlers
CustomLoggingHandler
andzap.Logger
for HTTP request loggingConsole example. Note
DEBUG
is actually in green:Kubernetes logs example.
Closes #539