chore: add debug flag + housekeeping

This commit is contained in:
atagen 2025-06-23 12:49:34 +10:00
parent 18d349c11f
commit 67e77c122f
4 changed files with 29 additions and 12 deletions

View file

@ -2,7 +2,7 @@ mod ipc;
mod manager;
mod socket;
use std::io::Read;
use std::{env, io::Read};
use anyhow::{Context, Result, anyhow};
use microxdg::Xdg;
@ -28,10 +28,19 @@ fn main() -> Result<()> {
// let systemd know we're ready
let _ = libsystemd::daemon::notify(false, &[libsystemd::daemon::NotifyState::Ready])?;
// debug stuff
let debug = env::var("NIRI_TAG_DEBUG").is_ok();
tracing_subscriber::fmt()
.with_max_level(tracing::Level::DEBUG)
.with_max_level(if debug {
tracing::Level::DEBUG
} else {
tracing::Level::INFO
})
.init();
let span = tracing::span!(tracing::Level::DEBUG, "main");
let span = if debug {
tracing::span!(tracing::Level::DEBUG, "main")
} else {
tracing::span!(tracing::Level::INFO, "main")
};
let _ = span.enter();
// spawn socket consumer for niri event stream
let (niri_tx, niri_rx) = smol::channel::unbounded();