zebrad: add a use_color option to the tracing config.
This is useful for creating searchable logs without having to filter color codes after the fact.
This commit is contained in:
parent
e8c16b172f
commit
1df9284444
|
|
@ -23,7 +23,7 @@ impl Tracing {
|
|||
|
||||
// Construct a tracing subscriber with the supplied filter and enable reloading.
|
||||
let builder = FmtSubscriber::builder()
|
||||
.with_ansi(true)
|
||||
.with_ansi(config.use_color)
|
||||
.with_env_filter(filter)
|
||||
.with_filter_reloading();
|
||||
let filter_handle = builder.reload_handle();
|
||||
|
|
|
|||
|
|
@ -43,6 +43,11 @@ pub struct ZebradConfig {
|
|||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[serde(deny_unknown_fields, default)]
|
||||
pub struct TracingSection {
|
||||
/// Whether to use colored terminal output, if available.
|
||||
///
|
||||
/// Defaults to `true`.
|
||||
pub use_color: bool,
|
||||
|
||||
/// The filter used for tracing events.
|
||||
///
|
||||
/// The filter is used to create a `tracing-subscriber`
|
||||
|
|
@ -101,6 +106,7 @@ pub struct TracingSection {
|
|||
impl Default for TracingSection {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
use_color: true,
|
||||
filter: None,
|
||||
endpoint_addr: None,
|
||||
flamegraph: None,
|
||||
|
|
|
|||
Loading…
Reference in New Issue