Add tracing and miette error infrastructure to wrsrvd

This commit is contained in:
Till Wegmueller 2026-04-04 18:20:52 +02:00
parent 4e08dfb5a9
commit 2d68ab6e8d
2 changed files with 31 additions and 2 deletions

View file

@ -0,0 +1,16 @@
use miette::Diagnostic;
use thiserror::Error;
#[derive(Debug, Error, Diagnostic)]
pub enum WayRayError {
#[error("failed to initialize Winit backend")]
#[diagnostic(help("ensure a display server (X11 or Wayland) is running"))]
BackendInit(#[source] Box<dyn std::error::Error + Send + Sync>),
#[error("failed to initialize Wayland display")]
#[diagnostic(help("check that the XDG_RUNTIME_DIR environment variable is set"))]
DisplayInit(#[source] Box<dyn std::error::Error + Send + Sync>),
#[error("event loop error")]
EventLoop(#[source] Box<dyn std::error::Error + Send + Sync>),
}

View file

@ -1,3 +1,16 @@
fn main() {
println!("wrsrvd compositor");
mod errors;
use miette::Result;
use tracing::info;
fn main() -> Result<()> {
tracing_subscriber::fmt()
.with_env_filter(
tracing_subscriber::EnvFilter::try_from_default_env()
.unwrap_or_else(|_| tracing_subscriber::EnvFilter::new("info")),
)
.init();
info!("wrsrvd starting");
Ok(())
}