I wanted to extend the functionality of the lazy logger to allow emitting 0 fields (for optional fields) or more than one field (for multiple lazy fields computed from the same object).
The one downside I see is that this makes it so the number of fields encoded is not equal to the number of fields passed in. This means that the array can't be pre-allocated to the exact right capacity. I think that's a reasonable trade-off though.
For the expected use case (emitting exactly one field form a lazy logger), this should work mostly as expected. For unexpected use cases, this might be a change in behavior. Before, it was last write wins, but now it will emit all fields.
R: @bg451 @iredelmeier
CC: @jmacd
Summary of Change
I wanted to extend the functionality of the lazy logger to allow emitting 0 fields (for optional fields) or more than one field (for multiple lazy fields computed from the same object).
The one downside I see is that this makes it so the number of fields encoded is not equal to the number of fields passed in. This means that the array can't be pre-allocated to the exact right capacity. I think that's a reasonable trade-off though.
For the expected use case (emitting exactly one field form a lazy logger), this should work mostly as expected. For unexpected use cases, this might be a change in behavior. Before, it was last write wins, but now it will emit all fields.