Browse Source

minor fixes, use log where applicable

master
Alison Watson 11 months ago
parent
commit
6ea518d57b
  1. 11
      bl/main.rs
  2. 2
      fw/conf.rs
  3. 1
      fw/data/read.rs
  4. 4
      fw/render.rs

11
bl/main.rs

@ -37,20 +37,17 @@ fn main() {
log::set_logger(&LOG).unwrap();
log::set_max_level(log::LevelFilter::Trace);
log::info!("Begin logging.");
let conf = fw::conf::Conf::read("blonkus.toml").unwrap_or_else(|err| {
match err {
| fw::conf::Err::NoFile => {
println!("{}", err)
}
| _ => eprintln!("{}", err),
| fw::conf::Err::NoFile => log::info!("{}", err),
| _ => log::warn!("{}", err),
};
println!("Using default configuration.");
log::info!("Using default configuration.");
fw::conf::Conf::default()
});
log::info!("begin the begin");
entry(&conf).unwrap();
}

2
fw/conf.rs

@ -24,7 +24,7 @@ impl From<std::io::Error> for Err {
}
impl Conf {
pub fn read(path: &'static str) -> Result<Self, Err> {
pub fn read(path: impl AsRef<std::path::Path>) -> Result<Self, Err> {
Ok(toml::from_str(&std::fs::read_to_string(path)?)?)
}
}

1
fw/data/read.rs

@ -121,7 +121,6 @@ pub fn hunk(rd: &mut impl Read, size: usize) -> io::Result<Vec<u8>> {
unsafe {
data.set_len(size);
}
rd.read_exact(&mut data)?;
Ok(data)

4
fw/render.rs

@ -755,7 +755,7 @@ impl StaticData {
unsafe fn seize_device(&self) {
if let Err(e) = unsafe { self.dev.device_wait_idle() } {
eprintln!("Error seizing renderer state: {}", e);
log::warn!("Error seizing renderer state: {}", e);
}
}
@ -806,7 +806,7 @@ impl Renderer {
self.sc = self.st.new_sc(&self.conf)?;
},
| Err(res) => {
eprintln!("Error rendering frame: {}", res);
log::warn!("Error rendering frame: {}", res);
}
}

Loading…
Cancel
Save