discard errors on log write

this at least removes a panic that crashes processes. it does
mean that some log messages can get silently lost, but this is
better than crashing if the arguments to the logger can't be
parsed for some reason?
This commit is contained in:
bunnie 2021-10-10 18:32:00 +08:00
parent 7a724a15cf
commit 5fa8f2a6a3

View file

@ -69,7 +69,10 @@ impl XousLoggerBacking<'_> {
}
let mut wrapper = cursor::BufferWrapper::new(&mut log_record.args);
write!(wrapper, "{}", record.args()).unwrap();
match write!(wrapper, "{}", record.args()) {
Ok(_) => {},
Err(_e) => {}, // if there's an error on the write, just silently discard it...
}
log_record.args_length = wrapper.len() as u32;
}