1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#![warn(rust_2018_idioms, unreachable_pub, missing_docs)]
use std::sync::Arc;
use parking_lot::Mutex;
use tracing::error;
use elfo_core::{
dumping::{self, Recorder},
Schema,
};
use self::dump_storage::DumpStorage;
mod actor;
mod dump_storage;
mod file_registry;
mod recorder;
mod reporter;
mod rule_set;
mod serializer;
#[cfg(not(docsrs))]
mod config;
#[cfg(docsrs)]
pub mod config;
pub fn new() -> Schema {
let storage = Arc::new(Mutex::new(DumpStorage::new()));
let schema = actor::new(storage.clone());
let is_ok = dumping::set_make_recorder(Box::new(move |class| {
storage.lock().registry(class) as Arc<dyn Recorder>
}));
if !is_ok {
error!("failed to set a dump recorder");
}
schema
}