manta-shared 2.0.0-beta.12

Shared types and pure helpers used by both manta-cli and manta-server.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Tracing-subscriber initialisation shared by both binaries.

use tracing_subscriber::EnvFilter;

/// Configure the global tracing subscriber and bridge `log::` calls into it.
///
/// `log_level` is an `EnvFilter` directive string, e.g. `"info"`, `"debug"`,
/// or `"manta=debug,hyper=warn"`. Falls back to `"error"` on parse failure.
pub fn configure(log_level: String) {
  let filter =
    EnvFilter::try_new(&log_level).unwrap_or_else(|_| EnvFilter::new("error"));

  tracing_subscriber::fmt()
    .with_env_filter(filter)
    .without_time()
    .with_target(false)
    .init();
}