mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-05-26 20:49:55 +00:00
20 lines
365 B
Rust
20 lines
365 B
Rust
|
|
use std::sync::{Arc, Mutex};
|
||
|
|
|
||
|
|
use super::{super::fmt, Closure};
|
||
|
|
|
||
|
|
pub fn to_html<S>(out: &Arc<Mutex<S>>) -> Box<Closure>
|
||
|
|
where
|
||
|
|
S: std::fmt::Write + Send + 'static,
|
||
|
|
{
|
||
|
|
let out = out.clone();
|
||
|
|
Box::new(move |data| {
|
||
|
|
fmt::html(
|
||
|
|
&mut *out.lock().expect("locked"),
|
||
|
|
&data.level(),
|
||
|
|
data.span_name(),
|
||
|
|
data.message(),
|
||
|
|
)
|
||
|
|
.expect("log line appended");
|
||
|
|
})
|
||
|
|
}
|