Skip to content

Commit

Permalink
logger: Don't log to stdout/err, if cosmic-session started us
Browse files Browse the repository at this point in the history
  • Loading branch information
Drakulix committed Jan 17, 2025
1 parent 3836670 commit d47754d
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/logger/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,20 @@ pub fn init_logger() -> Result<()> {
let fmt_layer = fmt::layer().compact();

match journald::layer() {
Ok(journald_layer) => tracing_subscriber::registry()
.with(fmt_layer)
.with(journald_layer)
.with(filter)
.init(),
Ok(journald_layer) => {
if std::env::var_os("COSMIC_SESSION_SOCK").is_some() {
tracing_subscriber::registry()
.with(journald_layer)
.with(filter)
.init()
} else {
tracing_subscriber::registry()
.with(fmt_layer)
.with(journald_layer)
.with(filter)
.init()
}
}
Err(err) => {
tracing_subscriber::registry()
.with(fmt_layer)
Expand Down

0 comments on commit d47754d

Please sign in to comment.