mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-02 04:03:35 +00:00
Remove test_logger feature (#9125)
- #9107 Remove all instances of `test_logger` in the code Co-Authored-By: Tan Chee Keong <tanck@sigmaprime.io>
This commit is contained in:
@@ -4,12 +4,11 @@ version = "0.2.0"
|
||||
authors = ["blacktemplar <blacktemplar@a1.net>"]
|
||||
edition = { workspace = true }
|
||||
|
||||
[features]
|
||||
# Print log output to stderr when running tests instead of dropping it.
|
||||
test_logger = []
|
||||
|
||||
[dependencies]
|
||||
chrono = { version = "0.4", default-features = false, features = ["clock", "std"] }
|
||||
chrono = { version = "0.4", default-features = false, features = [
|
||||
"clock",
|
||||
"std",
|
||||
] }
|
||||
logroller = { workspace = true }
|
||||
metrics = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
|
||||
@@ -42,16 +42,15 @@ impl TimeLatch {
|
||||
|
||||
/// Return a tracing subscriber suitable for test usage.
|
||||
///
|
||||
/// By default no logs will be printed, but they can be enabled via
|
||||
/// the `test_logger` feature. This feature can be enabled for any
|
||||
/// dependent crate by passing `--features logging/test_logger`, e.g.
|
||||
/// By default no logs will be printed, logs will be printed by using --nocapture. Example:
|
||||
/// ```bash
|
||||
/// cargo test -p beacon_chain --features logging/test_logger
|
||||
/// cargo test --release -p beacon_chain -- --nocapture
|
||||
/// ```
|
||||
pub fn create_test_tracing_subscriber() {
|
||||
if cfg!(feature = "test_logger") {
|
||||
let _ = tracing_subscriber::fmt()
|
||||
.with_env_filter(EnvFilter::try_new("debug").unwrap())
|
||||
.try_init();
|
||||
}
|
||||
let _ = tracing_subscriber::fmt()
|
||||
.with_test_writer()
|
||||
.with_env_filter(
|
||||
EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("debug")),
|
||||
)
|
||||
.try_init();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user