Cargo Features
[dependencies]
slog = { version = "2.8.2", default-features = false, features = ["nested-values", "dynamic-keys", "std", "nothreads", "anyhow", "parking_lot_0_12", "max_level_off", "max_level_info", "max_level_trace", "release_max_level_error", "release_max_level_info", "release_max_level_trace"] }
- default = nested-values, std
-
These default features are set whenever
slogis added withoutsomewhere in the dependency tree.default-features = false - nested-values default
-
Support nesting values in log messages using serde
Using this is recommended to improve the detail of log messages.
Without it, only flat values like numbers and strings can be logged.
This requires the underlying logger to support this feature,
usually requiring a nested-values feature flag on the logging backend.Enables erased-serde ^0.3 and serde_core
serde_core:
Depending on serde_core rather than serde reduces compile times (added in serde v1.0.200)
Affects
slog::Serializer.emit_serde,slog::SerdeValue,slog::Serde… - dynamic-keys
-
DANGER: Use a String for slog::Key insated of &'static str
This is discouraged, becauase it can break other libraries relying on slog.
If you really need to dynamically allocate keys, you can use String::leak to achieve the same functionality without breaking other libraries. - std default
-
Require the standard library.
Enables std of optional anyhow and optional serde_core
Affects
slog::MutexDrainError… - nothreads
-
DANGER: Remove the Send + Sync bound from the default logger and drain.
This feature is highly discouraged, because it could break other libraries relying on slog.
It is possible to achieve the same functionality by using a custom drain parameter to slog::Logger,
which will not break other libraries and avoids the overhead of an Arc. - anyhow
-
Implement slog::Value for anyhow::Error
Enables anyhow
- parking_lot_0_12
-
Implement slog::Drain for parking_lot::Mutex.
Each version of parking_lot has a separate feature name, so that multiple versions of parking_lot can be supported at once without causing conflicts. This works because Cargo supports depending on multiple versions of the same crate, and Rust considers parking_lot_0_12::Mutex and parking_lot1::Mutex as completely different types.
Compatibility Guarantees: New versions of parking_lot can be added in a patch version of slog (2.8.1 -> 2.8.2)
Support for an old version of parking_lot will be reatined as long as reasonably possible, and only removed if it causes significant issues or is known to be severely buggy. In the exceptional event that support for an old version is removed, it will only happen in a slog minor version upgrade (2.8 -> 2.9), never in a patch version upgrade.
A hypothetical parking_lot v1.0 release would be named
parking_lot1rather thanparking_lot_1.Enables parking_lot
- max_level_off
-
Control the log level at compile-time
- max_level_error max_level_warn max_level_info
- max_level_debug max_level_trace
- release_max_level_off release_max_level_error
- release_max_level_warn release_max_level_info
- release_max_level_debug release_max_level_trace