forked from uber-go/zap
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Demonstrate jsonEncoder and MapObjectEncoder differences
Add test cases to demonstrate uber-go#554, how jsonEncoder and MapObjectEncoder handle namespaces differently. Specifically: When foo.MarshalLogObject uses OpenNamespace, jsonEncoder.AddObject does not close the namespace.
- Loading branch information
1 parent
cb3eb92
commit 367a5f7
Showing
2 changed files
with
110 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Upon reflection I think this expected output is correct, and the fact the test fails represents a bug in
zapcore.jsonEncoder
.jsonEncoder.AddObject
adds an}
to close the object itself, but not any nested namespaces.Fields logged after are added to the object, but not the nested namespace.