Skip to content

Commit d47754d

Browse files
committedJan 17, 2025·
logger: Don't log to stdout/err, if cosmic-session started us
1 parent 3836670 commit d47754d

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed
 

‎src/logger/mod.rs

+14-5
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,20 @@ pub fn init_logger() -> Result<()> {
3030
let fmt_layer = fmt::layer().compact();
3131

3232
match journald::layer() {
33-
Ok(journald_layer) => tracing_subscriber::registry()
34-
.with(fmt_layer)
35-
.with(journald_layer)
36-
.with(filter)
37-
.init(),
33+
Ok(journald_layer) => {
34+
if std::env::var_os("COSMIC_SESSION_SOCK").is_some() {
35+
tracing_subscriber::registry()
36+
.with(journald_layer)
37+
.with(filter)
38+
.init()
39+
} else {
40+
tracing_subscriber::registry()
41+
.with(fmt_layer)
42+
.with(journald_layer)
43+
.with(filter)
44+
.init()
45+
}
46+
}
3847
Err(err) => {
3948
tracing_subscriber::registry()
4049
.with(fmt_layer)

0 commit comments

Comments
 (0)
Please sign in to comment.