parent
895ce91543
commit
3d55cba06c
2 changed files with 12 additions and 3 deletions
|
|
@ -62,7 +62,7 @@ tracing = { version = "0.1.44", features = [
|
|||
"max_level_debug",
|
||||
"release_max_level_info",
|
||||
] }
|
||||
tracing-journald = "0.3.2"
|
||||
tracing-journald = { version = "0.3.2", optional = true }
|
||||
tracing-subscriber = { version = "0.3.22", features = [
|
||||
"env-filter",
|
||||
"tracing-log",
|
||||
|
|
@ -122,7 +122,7 @@ optional = true
|
|||
debug = ["egui", "egui_plot", "smithay-egui", "anyhow/backtrace"]
|
||||
default = ["systemd"]
|
||||
logind = ["logind-zbus"]
|
||||
systemd = ["libsystemd", "logind"]
|
||||
systemd = ["libsystemd", "logind", "tracing-journald"]
|
||||
profile-with-tracy = ["profiling/profile-with-tracy", "tracy-client/default"]
|
||||
profile-with-tracy-gpu = ["profile-with-tracy", "smithay/tracy_gpu_profiling"]
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,10 @@ use std::str::FromStr;
|
|||
|
||||
use anyhow::Result;
|
||||
|
||||
use tracing::{debug, info, warn};
|
||||
#[cfg(feature = "systemd")]
|
||||
use tracing::warn;
|
||||
use tracing::{debug, info};
|
||||
#[cfg(feature = "systemd")]
|
||||
use tracing_journald as journald;
|
||||
use tracing_subscriber::{EnvFilter, filter::Directive, fmt, prelude::*};
|
||||
|
||||
|
|
@ -29,6 +32,7 @@ pub fn init_logger() -> Result<()> {
|
|||
|
||||
let fmt_layer = fmt::layer().compact();
|
||||
|
||||
#[cfg(feature = "systemd")]
|
||||
match journald::layer() {
|
||||
Ok(journald_layer) => tracing_subscriber::registry()
|
||||
.with(fmt_layer)
|
||||
|
|
@ -43,6 +47,11 @@ pub fn init_logger() -> Result<()> {
|
|||
warn!(?err, "Failed to init journald logging.");
|
||||
}
|
||||
};
|
||||
#[cfg(not(feature = "systemd"))]
|
||||
tracing_subscriber::registry()
|
||||
.with(fmt_layer)
|
||||
.with(filter)
|
||||
.init();
|
||||
log_panics::init();
|
||||
|
||||
info!("Version: {}", std::env!("CARGO_PKG_VERSION"));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue