Skip to content
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

new sub logger using with can not get right log format #3

Closed
lysu opened this issue Mar 4, 2019 · 1 comment · Fixed by #4
Closed

new sub logger using with can not get right log format #3

lysu opened this issue Mar 4, 2019 · 1 comment · Fixed by #4

Comments

@lysu
Copy link
Collaborator

lysu commented Mar 4, 2019

what we do

func (s *testLogSuite) TestContextLogger(c *C)  {
	l, _, err := zaplog.InitLogger(&zaplog.Config{DisableStacktrace:true})
	if err != nil {
		panic(err)
	}
	l2 := l.With(zap.String("c", "c1"))
	l2.Error("", zap.String("k", "v"), zap.String("k2", "v2"))
}

expect

[2019/03/04 23:00:05.943 +08:00] [ERROR] [log_test.go:209] [c=c1] [k=v] [k2=v2]

but got

[2019/03/04 23:00:05.943 +08:00] [ERROR] [log_test.go:209],c=c1 [k=v] [k2=v2]
@lysu
Copy link
Collaborator Author

lysu commented Mar 4, 2019

ref pingcap/tidb#9548

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant