add config item for with_span_events
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
9790a6edc9
commit
e2afaa9f03
2 changed files with 15 additions and 2 deletions
|
@ -606,6 +606,12 @@ pub struct Config {
|
||||||
#[serde(default = "true_fn", alias = "log_colours")]
|
#[serde(default = "true_fn", alias = "log_colours")]
|
||||||
pub log_colors: bool,
|
pub log_colors: bool,
|
||||||
|
|
||||||
|
/// configures the span events which will be outputted with the log
|
||||||
|
///
|
||||||
|
/// default: "none"
|
||||||
|
#[serde(default = "default_log_span_events")]
|
||||||
|
pub log_span_events: String,
|
||||||
|
|
||||||
/// OpenID token expiration/TTL in seconds
|
/// OpenID token expiration/TTL in seconds
|
||||||
///
|
///
|
||||||
/// These are the OpenID tokens that are primarily used for Matrix account
|
/// These are the OpenID tokens that are primarily used for Matrix account
|
||||||
|
@ -1958,6 +1964,9 @@ pub fn default_log() -> String {
|
||||||
.to_owned()
|
.to_owned()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[must_use]
|
||||||
|
pub fn default_log_span_events() -> String { "none".into() }
|
||||||
|
|
||||||
fn default_notification_push_path() -> String { "/_matrix/push/v1/notify".to_owned() }
|
fn default_notification_push_path() -> String { "/_matrix/push/v1/notify".to_owned() }
|
||||||
|
|
||||||
fn default_openid_token_ttl() -> u64 { 60 * 60 }
|
fn default_openid_token_ttl() -> u64 { 60 * 60 }
|
||||||
|
|
|
@ -3,7 +3,8 @@ use std::sync::Arc;
|
||||||
use conduit::{
|
use conduit::{
|
||||||
config::Config,
|
config::Config,
|
||||||
debug_warn, err,
|
debug_warn, err,
|
||||||
log::{capture, LogLevelReloadHandles},
|
log::{capture, fmt_span, LogLevelReloadHandles},
|
||||||
|
result::UnwrapOrErr,
|
||||||
Result,
|
Result,
|
||||||
};
|
};
|
||||||
use tracing_subscriber::{layer::SubscriberExt, reload, EnvFilter, Layer, Registry};
|
use tracing_subscriber::{layer::SubscriberExt, reload, EnvFilter, Layer, Registry};
|
||||||
|
@ -18,7 +19,10 @@ pub(crate) fn init(config: &Config) -> Result<(LogLevelReloadHandles, TracingFla
|
||||||
let reload_handles = LogLevelReloadHandles::default();
|
let reload_handles = LogLevelReloadHandles::default();
|
||||||
|
|
||||||
let console_filter = EnvFilter::try_new(&config.log).map_err(|e| err!(Config("log", "{e}.")))?;
|
let console_filter = EnvFilter::try_new(&config.log).map_err(|e| err!(Config("log", "{e}.")))?;
|
||||||
let console_layer = tracing_subscriber::fmt::Layer::new().with_ansi(config.log_colors);
|
let console_span_events = fmt_span::from_str(&config.log_span_events).unwrap_or_err();
|
||||||
|
let console_layer = tracing_subscriber::fmt::Layer::new()
|
||||||
|
.with_ansi(config.log_colors)
|
||||||
|
.with_span_events(console_span_events);
|
||||||
let (console_reload_filter, console_reload_handle) = reload::Layer::new(console_filter.clone());
|
let (console_reload_filter, console_reload_handle) = reload::Layer::new(console_filter.clone());
|
||||||
reload_handles.add("console", Box::new(console_reload_handle));
|
reload_handles.add("console", Box::new(console_reload_handle));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue