cursive-logger-view

A fork of cursive-logger-view-view.
This project provides a new debug view for gyscos/cursive using the emabee/flexi_logger crate. This enables the FlexiLoggerView to respect the RUST_LOG environment variable as well as the flexi_logger configuration file.

Usage
Simply add dependencies
cargo add log flexi_logger cursive cursive_logger_view
Using the FlexiLoggerView
use cursive_logger_view::{CursiveLogWriter, FlexiLoggerView};
use flexi_logger::Logger;
fn main() {
let mut siv = cursive::default();
Logger::try_with_env_or_str("trace")
.expect("Could not create Logger from environment :(")
.log_to_file_and_writer(
flexi_logger::FileSpec::default()
.directory("logs")
.suppress_timestamp(),
CursiveLogWriter::new(&siv)
.into_boxed(),
)
.start()
.expect("failed to initialize logger!");
siv.add_layer(
FlexiLoggerView::new()
.wrap_scroll_view(),
);
log::debug!("x: 42");
log::info!("Foo\nBar"); log::error!("Failed to open file");
siv.run()
}
Look into the documentation for a detailed explanation on the API.