Updated LogPlugin Documentation with Performance Warning (#14984)

# Objective

- Fixes #14966

## Solution

- Added a _Performance_ section to the documentation for
`LogPlugin::filter` explaining that long filter strings can degrade
performance and to instead rely on `LogPlugin::level` when possible.

## Testing

- CI passed locally.
This commit is contained in:
Zachary Harrold 2024-09-03 10:48:19 +10:00 committed by GitHub
parent 323aa70e3c
commit 250cc63ddf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -133,6 +133,20 @@ pub(crate) struct FlushGuard(SyncCell<tracing_chrome::FlushGuard>);
/// This plugin should not be added multiple times in the same process. This plugin
/// sets up global logging configuration for **all** Apps in a given process, and
/// rerunning the same initialization multiple times will lead to a panic.
///
/// # Performance
///
/// Filters applied through this plugin are computed at _runtime_, which will
/// have a non-zero impact on performance.
/// To achieve maximum performance, consider using
/// [_compile time_ filters](https://docs.rs/log/#compile-time-filters)
/// provided by the [`log`](https://crates.io/crates/log) crate.
///
/// ```toml
/// # cargo.toml
/// [dependencies]
/// log = { version = "0.4", features = ["max_level_debug", "release_max_level_warn"] }
/// ```
pub struct LogPlugin {
/// Filters logs using the [`EnvFilter`] format
pub filter: String,