cloudflare / cloudflare/foundations

Add log setting to panic when field is overwritten

Open
#243 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
1.7k
Forks
133
Avg merge
1d 5h
Merged PRs (30d)
11

Description

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.