mirror of
https://github.com/stalwartlabs/mail-server.git
synced 2025-02-25 08:23:00 +08:00
Journal support
This commit is contained in:
parent
0a640c3758
commit
216fcf2d73
4 changed files with 25 additions and 1 deletions
12
Cargo.lock
generated
12
Cargo.lock
generated
|
@ -5484,6 +5484,17 @@ dependencies = [
|
|||
"valuable",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing-journald"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ba316a74e8fc3c3896a850dba2375928a9fa171b085ecddfc7c054d39970f3fd"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"tracing-core",
|
||||
"tracing-subscriber",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing-log"
|
||||
version = "0.1.3"
|
||||
|
@ -5775,6 +5786,7 @@ dependencies = [
|
|||
"tokio-rustls",
|
||||
"tracing",
|
||||
"tracing-appender",
|
||||
"tracing-journald",
|
||||
"tracing-opentelemetry",
|
||||
"tracing-subscriber",
|
||||
]
|
||||
|
|
|
@ -363,7 +363,7 @@ impl SMTP {
|
|||
assert_eq!(value, expected, "Variable {name:?} has unexpected value");
|
||||
} else {
|
||||
panic!("Missing variable {name:?} with value {expected:?}\nExpected {:?}\nFound: {:?}",
|
||||
expected_variables.keys().collect::<Vec<_>>(),
|
||||
expected_variables.keys().collect::<Vec<_>>(),
|
||||
instance.global_variable_names().collect::<Vec<_>>());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ ahash = { version = "0.8" }
|
|||
|
||||
[target.'cfg(unix)'.dependencies]
|
||||
privdrop = "0.5.3"
|
||||
tracing-journald = "0.3"
|
||||
|
||||
[features]
|
||||
test_mode = []
|
||||
|
|
|
@ -179,6 +179,17 @@ pub fn enable_tracing(config: &Config, message: &str) -> config::Result<Option<W
|
|||
|
||||
Ok(None)
|
||||
}
|
||||
#[cfg(unix)]
|
||||
"journal" => {
|
||||
tracing::subscriber::set_global_default(
|
||||
tracing_subscriber::Registry::default()
|
||||
.with(tracing_journald::layer().failed("Failed to configure journal"))
|
||||
.with(env_filter),
|
||||
)
|
||||
.failed("Failed to set subscriber");
|
||||
|
||||
Ok(None)
|
||||
}
|
||||
_ => Ok(None),
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue