fix(startup): add init logging + fix app_lib → robin_lib in main.rs
- Fix main.rs: app_lib crate name was wrong, should be robin_lib - Add log::info! on pattern load success/failure — startup was completely silent making smoke testing and production diagnosis impossible - Log pattern count and dual-boot supplement count on load - Log matched pattern id on every notification dispatch - These messages appear in ~/.local/share/tech.circuitforge.robin/logs/Robin.log
This commit is contained in:
parent
f0269c62a5
commit
8e28ac2624
2 changed files with 20 additions and 4 deletions
|
|
@ -44,15 +44,30 @@ pub fn run() {
|
|||
config::SourceOs::IpadOs => "ipad",
|
||||
config::SourceOs::Unknown => "unknown",
|
||||
};
|
||||
let mut pf = patterns::load(source, migration.source_distro_family.as_deref(), family).ok();
|
||||
log::info!("robin: loading patterns for {source} → {family} (distro: {})", migration.distro);
|
||||
let mut pf = match patterns::load(source, migration.source_distro_family.as_deref(), family) {
|
||||
Ok(p) => {
|
||||
log::info!("robin: loaded {} patterns", p.patterns.len());
|
||||
Some(p)
|
||||
}
|
||||
Err(e) => {
|
||||
log::warn!("robin: no pattern file found ({e}) — notifications disabled");
|
||||
None
|
||||
}
|
||||
};
|
||||
// Layer dual-boot supplement patterns on top when a co-installed OS is configured.
|
||||
if let (Some(ref mut primary), Some(ref dualboot)) = (&mut pf, &migration.dual_boot_with) {
|
||||
if let Ok(supplement) = patterns::load_supplement(dualboot) {
|
||||
primary.extend(supplement);
|
||||
match patterns::load_supplement(dualboot) {
|
||||
Ok(supplement) => {
|
||||
log::info!("robin: loaded {} dual-boot supplement patterns for {dualboot}", supplement.patterns.len());
|
||||
primary.extend(supplement);
|
||||
}
|
||||
Err(e) => log::warn!("robin: dual-boot supplement not found for {dualboot}: {e}"),
|
||||
}
|
||||
}
|
||||
pf
|
||||
} else {
|
||||
log::info!("robin: no migration config — onboarding needed");
|
||||
None
|
||||
};
|
||||
|
||||
|
|
@ -70,6 +85,7 @@ pub fn run() {
|
|||
while let Some(event) = rx.recv().await {
|
||||
if let Some(ref pf) = *pf {
|
||||
if let Some(matched) = patterns::classify(&event, pf) {
|
||||
log::info!("robin: matched pattern '{}' — dispatching notification", matched.pattern_id);
|
||||
notify::dispatch(&app_handle, matched);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,5 +2,5 @@
|
|||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
|
||||
fn main() {
|
||||
app_lib::run();
|
||||
robin_lib::run();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue