When log fields are added in a loop without forking the logger, it is easy to create very long logger chains and hit stack overflows on drop. We have some workarounds in place already to help detect such cases (#47 and #189), but a key insight is that often the same key will be set many times.
A new LoggingSetting that makes foundations panic when a key is overwritten would help detect such cases. Sometimes overriding a key is intentional, so we also need an escape hatch in the log::add_fields macro that explicitly allows overwriting existing keys.
When log fields are added in a loop without forking the logger, it is easy to create very long logger chains and hit stack overflows on drop. We have some workarounds in place already to help detect such cases (#47 and #189), but a key insight is that often the same key will be set many times.
A new
LoggingSettingthat makes foundations panic when a key is overwritten would help detect such cases. Sometimes overriding a key is intentional, so we also need an escape hatch in thelog::add_fieldsmacro that explicitly allows overwriting existing keys.