use std::io;
use arrayvec::ArrayVec;
use syslog_fmt::{
Severity,
v5424::{self, Timestamp},
};
#[global_allocator]
static ALLOC: dhat::Alloc = dhat::Alloc;
fn main() -> io::Result<()> {
let _datetime = chrono::Local::now();
let formatter = v5424::Config {
app_name: Some("default_config_example"),
..Default::default()
}
.into_formatter();
let _profiler = dhat::Profiler::builder().testing().build();
let mut buf = ArrayVec::<u8, 256>::new();
formatter
.write_with_data(
&mut buf,
Severity::Info,
Timestamp::CreateChronoLocal,
"'su root' failed for lonvick on /dev/pts/8",
None,
[(
"exampleSDID@32473",
[
("iut", "3"),
("eventSource", "Application"),
("eventID", "1011"),
],
)],
)
.unwrap();
let stats = dhat::HeapStats::get();
dhat::assert_eq!(stats.total_bytes, 0);
Ok(())
}