feat: add startup diagnostics for environment issues
- Log HOME, PATH, XDG_DATA_HOME at startup - Warn when critical env vars are missing - Log item count per provider after refresh This helps diagnose why items may not load when launched from window manager keybinds vs terminal. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
14
src/main.rs
14
src/main.rs
@@ -8,7 +8,7 @@ mod ui;
|
||||
|
||||
use app::OwlryApp;
|
||||
use cli::CliArgs;
|
||||
use log::info;
|
||||
use log::{info, warn};
|
||||
|
||||
fn main() {
|
||||
env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("info")).init();
|
||||
@@ -17,6 +17,18 @@ fn main() {
|
||||
|
||||
info!("Starting Owlry launcher");
|
||||
|
||||
// Diagnostic: log critical environment variables
|
||||
let home = std::env::var("HOME").unwrap_or_else(|_| "<not set>".to_string());
|
||||
let path = std::env::var("PATH").unwrap_or_else(|_| "<not set>".to_string());
|
||||
let xdg_data = std::env::var("XDG_DATA_HOME").unwrap_or_else(|_| "<not set>".to_string());
|
||||
info!("HOME={}", home);
|
||||
info!("PATH={}", path);
|
||||
info!("XDG_DATA_HOME={}", xdg_data);
|
||||
|
||||
if home == "<not set>" || path == "<not set>" {
|
||||
warn!("Critical environment variables missing! Items may not load correctly.");
|
||||
}
|
||||
|
||||
let app = OwlryApp::new(args);
|
||||
std::process::exit(app.run());
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ pub use uuctl::UuctlProvider;
|
||||
|
||||
use fuzzy_matcher::FuzzyMatcher;
|
||||
use fuzzy_matcher::skim::SkimMatcherV2;
|
||||
use log::info;
|
||||
|
||||
/// Represents a single searchable/launchable item
|
||||
#[derive(Debug, Clone)]
|
||||
@@ -110,6 +111,11 @@ impl ProviderManager {
|
||||
pub fn refresh_all(&mut self) {
|
||||
for provider in &mut self.providers {
|
||||
provider.refresh();
|
||||
info!(
|
||||
"Provider '{}' loaded {} items",
|
||||
provider.name(),
|
||||
provider.items().len()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user