mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-18 00:01:24 +01:00
add observability infrastructure for cli subcmds
This commit is contained in:
parent
b93c39ee93
commit
b03c2a15b3
5 changed files with 96 additions and 10 deletions
|
|
@ -180,20 +180,34 @@ impl Display for ListenConfig {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Default, Debug, Deserialize)]
|
||||
#[derive(Copy, Clone, Default, Debug, Deserialize, clap::ValueEnum)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub(crate) enum LogFormat {
|
||||
/// Use the [`tracing_subscriber::fmt::format::Pretty`] formatter
|
||||
/// Multiple lines per event, includes all information
|
||||
Pretty,
|
||||
/// Use the [`tracing_subscriber::fmt::format::Full`] formatter
|
||||
|
||||
/// One line per event, includes most information
|
||||
#[default]
|
||||
Full,
|
||||
/// Use the [`tracing_subscriber::fmt::format::Compact`] formatter
|
||||
|
||||
/// One line per event, includes less information
|
||||
Compact,
|
||||
/// Use the [`tracing_subscriber::fmt::format::Json`] formatter
|
||||
|
||||
/// One JSON object per line per event, includes most information
|
||||
Json,
|
||||
}
|
||||
|
||||
impl Display for LogFormat {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
LogFormat::Pretty => write!(f, "pretty"),
|
||||
LogFormat::Full => write!(f, "full"),
|
||||
LogFormat::Compact => write!(f, "compact"),
|
||||
LogFormat::Json => write!(f, "json"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
#[serde(default)]
|
||||
pub(crate) struct TurnConfig {
|
||||
|
|
@ -404,7 +418,7 @@ fn default_max_request_size() -> u32 {
|
|||
20 * 1024 * 1024
|
||||
}
|
||||
|
||||
fn default_tracing_filter() -> EnvFilterClone {
|
||||
pub(crate) fn default_tracing_filter() -> EnvFilterClone {
|
||||
"info,ruma_state_res=warn"
|
||||
.parse()
|
||||
.expect("hardcoded env filter should be valid")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue