nest: Add PreNest marker (and other cleanups) #12
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
PreNest
marker allows us to drop the empty-string delimiters from library callers and still get readable output fromfmt.Print
-style renderers. I've added a new unit test showing that log implementations that want to detectMarker
s should usereflect.DeepEqual
or something else that is stricter than==
.I've also adjusted the expected order of keys in the unit-test map. Currently this output is unstable, but this (golang/go@a440cc0, golang/go#21095) will have the order stabilized in future Go releases. The change here sets us up for compatibility with that new logic.
I've also made the
Newf
andLogf
implementations more compact by turning them into wrappers aroundNew
andLog
respectively.I think this stabilizes around the library-consumer API we want here. There's probably still room for improvement in the parent-facing API (e.g. storing wrapping-call-site in the marker so parents can toggle logger display on a per-package basis?), but stabilizing that API is less important.