Files
continuwuity/src/core/log/capture/util.rs
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

20 lines
365 B
Rust
Raw Normal View History

2024-06-11 01:26:31 +00:00
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");
})
}