tracing capture interface
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
1bb4021b90
commit
aa34021b27
15 changed files with 284 additions and 27 deletions
19
src/core/log/capture/util.rs
Normal file
19
src/core/log/capture/util.rs
Normal file
|
@ -0,0 +1,19 @@
|
|||
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");
|
||||
})
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue