-
Notifications
You must be signed in to change notification settings - Fork 77
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 Zap logger and access log interceptor #944
Add Zap logger and access log interceptor #944
Conversation
[CHATOPS:HELP] ChatOps commands.
|
a333268
to
dc740d1
Compare
internal/log/glg/glg.go
Outdated
@@ -81,6 +85,10 @@ func (l *logger) Infof(format string, vals ...interface{}) { | |||
l.retry.Outf(l.glg.Infof, format, vals...) | |||
} | |||
|
|||
func (l *logger) Infod(msg string, details ...interface{}) { | |||
l.Infof(msg+"\tdetails: %#v", details) |
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 this format okay? 🤔
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.
please define default details format as const value on the top
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.
done.
Codecov Report
@@ Coverage Diff @@
## master #944 +/- ##
==========================================
+ Coverage 16.03% 16.25% +0.21%
==========================================
Files 476 479 +3
Lines 23839 24016 +177
==========================================
+ Hits 3822 3903 +81
- Misses 19772 19867 +95
- Partials 245 246 +1
Continue to review full report at Codecov.
|
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 never thought that you implement Infod like klog's InfoS, seems good idea.
internal/log/glg/glg.go
Outdated
@@ -81,6 +85,10 @@ func (l *logger) Infof(format string, vals ...interface{}) { | |||
l.retry.Outf(l.glg.Infof, format, vals...) | |||
} | |||
|
|||
func (l *logger) Infod(msg string, details ...interface{}) { | |||
l.Infof(msg+"\tdetails: %#v", details) |
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.
please define default details format as const value on the top
d268324
to
fc1e535
Compare
can you please check CI (test/internal & golangci-lint) |
Signed-off-by: Rintaro Okamura <[email protected]> :white_check_mark: fix tests for logger type, format Signed-off-by: Rintaro Okamura <[email protected]>
Signed-off-by: Rintaro Okamura <[email protected]> :heavy_plus_sign: add zap logger Signed-off-by: Rintaro Okamura <[email protected]> :white_check_mark: add zap tests Signed-off-by: Rintaro Okamura <[email protected]> :white_check_mark: add zap tests Signed-off-by: Rintaro Okamura <[email protected]> :arrow_up: Upgrade zap and revise tests Signed-off-by: Rintaro Okamura <[email protected]>
Signed-off-by: Rintaro Okamura <[email protected]> :sparkles: Add Close method to logger implementations Signed-off-by: Rintaro Okamura <[email protected]>
Signed-off-by: Rintaro Okamura <[email protected]>
Signed-off-by: Rintaro Okamura <[email protected]>
Signed-off-by: Rintaro Okamura <[email protected]>
Signed-off-by: Rintaro Okamura <[email protected]>
Signed-off-by: Rintaro Okamura <[email protected]>
Signed-off-by: Rintaro Okamura <[email protected]>
fc1e535
to
98a97da
Compare
"github.com/vdaas/vald/internal/errors" | ||
"github.com/vdaas/vald/internal/log/format" | ||
"github.com/vdaas/vald/internal/log/level" | ||
|
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.
🚫 [golangci] reported by reviewdog 🐶
File is not gci
-ed (gci)
|
||
type Option func(l *logger) | ||
|
||
var ( |
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.
🚫 [golangci] reported by reviewdog 🐶
File is not gofumpt
-ed (gofumpt)
if err := test.checkFunc(test.want, got, err); err != nil { | ||
tt.Errorf("error = %v", err) | ||
} | ||
|
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.
🚫 [golangci] reported by reviewdog 🐶
File is not gofumpt
-ed (gofumpt)
if err := test.checkFunc(test.want, l, err); err != nil { | ||
tt.Errorf("error = %v", err) | ||
} | ||
|
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.
🚫 [golangci] reported by reviewdog 🐶
File is not gofumpt
-ed (gofumpt)
@@ -76,6 +76,7 @@ func Do(ctx context.Context, opts ...Option) error { | |||
|
|||
if p.ShowVersion() { | |||
log.Init(log.WithLevel(level.INFO.String())) | |||
defer log.Close() |
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.
🚫 [golangci] reported by reviewdog 🐶
Error return value of log.Close
is not checked (errcheck)
@@ -95,6 +96,7 @@ func Do(ctx context.Context, opts ...Option) error { | |||
} else { | |||
log.Init() | |||
} | |||
defer log.Close() |
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.
🚫 [golangci] reported by reviewdog 🐶
Error return value of log.Close
is not checked (errcheck)
resolved. |
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.
LGTM
Description:
This PR is cherry-picked from #852 and revised.
Close()
Related Issue:
nothing
How Has This Been Tested?:
nothing
Environment:
Types of changes:
Changes to Core Features:
Checklist: