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

Inconsitance between Interface() and Fields() #346

Open
slsyy opened this issue Aug 17, 2021 · 1 comment
Open

Inconsitance between Interface() and Fields() #346

slsyy opened this issue Aug 17, 2021 · 1 comment

Comments

@slsyy
Copy link

slsyy commented Aug 17, 2021

Why these methods use a different mechanism for interface{} marshalling?

func ExampleInterface () {
	log := zerolog.New(os.Stdout)
	log.Info().Interface("foo", `<someXml></someXml>`).Send()

	// Output:
	// {"level":"info","foo":"\u003csomeXml\u003e\u003c/someXml\u003e"}
}

func ExampleFields () {
	log := zerolog.New(os.Stdout)
	log.Info().Fields(map[string]interface{}{"foo": `<someXml></someXml>`}).Send()

	// Output:
	// {"level":"info","foo":"<someXml></someXml>"}
}
@mitar
Copy link
Contributor

mitar commented Feb 23, 2022

This should be fixed by #414.

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

No branches or pull requests

2 participants