use appcore_log::{FileSinkConfig, LogOutputMode, LoggerConfig, LOG_SIZE_2_MIB};
fn main() -> Result<(), appcore_log::LogConfigError> {
let output = LogOutputMode::CrashOnly;
let logger = LoggerConfig {
output,
file: Some(FileSinkConfig {
path: std::env::temp_dir().join("my-application-crash.jsonl"),
max_bytes: LOG_SIZE_2_MIB,
sync_each_write: true,
retention: 1,
archive: None,
}),
crash_events: 128,
crash_bytes: 512 * 1024,
..LoggerConfig::default()
}
.build()?;
let log = logger.dispatcher().event(0, "application");
log.info("kept only in the bounded crash ring");
let _written_events = logger.dump_crash()?;
Ok(())
}