Thomasdezeeuw / std-logger

A logging implementation for the log crate that logs messages to standard error and requests to standard out.
https://docs.rs/std-logger
Apache License 2.0
9 stars 2 forks source link

Process aborted with BorrowMutError #42

Closed Thomasdezeeuw closed 3 years ago

Thomasdezeeuw commented 3 years ago

In log we borrow a RefCell and unwrap the result: https://github.com/Thomasdezeeuw/std-logger/blob/20e4307d85cd9e0c418674dab607ab33e75d9c55/src/lib.rs#L429

Somewhere in a double panic this lead to an aborted process on macOS while developing another crate. Two points to fix:

Thomasdezeeuw commented 3 years ago

This happens if a part of the log message panics. For example:

struct T;

impl fmt::Display for T {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        panic!()
    }
}

info!("T: {}", T);