rust-lang / log

Logging implementation for Rust
https://docs.rs/log
Apache License 2.0
2.16k stars 250 forks source link

Add `set_max_level_racy` and gate `set_max_level` #544

Closed djkoloski closed 1 year ago

djkoloski commented 1 year ago

Calling set_max_level can result in a race condition on platforms that don't have an atomic compare and swap implementation. This gates set_max_level behind #[cfg(atomic_cas)] and adds a racy alternative that can be called in these situations. This mirrors the approach for set_logger.

Fixes #534