pub struct FlexiLoggerView {
pub indent: bool,
}Expand description
The FlexiLoggerView displays log messages from the cursive_flexi_logger log target.
It is safe to create multiple instances of this struct.
Create a plain FlexiLoggerView
use cursive::{Cursive, CursiveExt};
use cursive_flexi_logger_view::FlexiLoggerView;
use flexi_logger::Logger;
fn main() {
// we need to initialize cursive first, as the cursive-flexi-logger
// needs a cursive callback sink to notify cursive about screen refreshs
// when a new log message arrives
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(),
cursive_flexi_logger_view::cursive_flexi_logger(&siv)
)
.format(flexi_logger::colored_with_thread)
.start()
.expect("failed to initialize logger!");
siv.add_layer(FlexiLoggerView::new()); // add a plain flexi-logger view
log::info!("test log message");
// siv.run();
}Create a scrollable FlexiLoggerView
use cursive::{Cursive, CursiveExt};
use cursive_flexi_logger_view::FlexiLoggerView;
use flexi_logger::Logger;
fn main() {
// we need to initialize cursive first, as the cursive-flexi-logger
// needs a cursive callback sink to notify cursive about screen refreshs
// when a new log message arrives
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(),
cursive_flexi_logger_view::cursive_flexi_logger(&siv)
)
.format(flexi_logger::colored_with_thread)
.start()
.expect("failed to initialize logger!");
siv.add_layer(FlexiLoggerView::scrollable()); // add a scrollable flexi-logger view
log::info!("test log message");
// siv.run();
}Fields
indent: boolImplementations
Create a new FlexiLoggerView which is wrapped in a ScrollView.
Trait Implementations
Draws the view with the given printer (includes bounds) and focus. Read more
Returns the minimum size the view requires with the given restrictions. Read more
Should return true if the view content changed since the last call
to layout(). Read more
Called when an event is received (key press, mouse event, …). Read more
fn call_on_any(
&mut self,
&Selector<'_>,
&'a mut (dyn FnMut(&mut (dyn View + 'static)) + 'a)
)
fn call_on_any(
&mut self,
&Selector<'_>,
&'a mut (dyn FnMut(&mut (dyn View + 'static)) + 'a)
)
Runs a closure on the view identified by the given selector. Read more
Moves the focus to the view identified by the given selector. Read more
Attempt to give this view the focus. Read more
What part of the view is important and should be visible? Read more
Auto Trait Implementations
impl RefUnwindSafe for FlexiLoggerView
impl Send for FlexiLoggerView
impl Sync for FlexiLoggerView
impl Unpin for FlexiLoggerView
impl UnwindSafe for FlexiLoggerView
Blanket Implementations
Mutably borrows from an owned value. Read more
Returns a Box<View>.
Wraps self in a ResizedView with the given size constraints.
Wraps self into a fixed-size ResizedView.
Wraps self into a fixed-width ResizedView.
Wraps self into a fixed-width ResizedView.
Wraps self into a full-screen ResizedView.
Wraps self into a full-width ResizedView.
Wraps self into a full-height ResizedView.
Wraps self into a limited-size ResizedView.
Wraps self into a limited-width ResizedView.
Wraps self into a limited-height ResizedView.
Wraps self into a ResizedView at least sized size.
Wraps self in a ResizedView at least min_width wide.
Wraps self in a ResizedView at least min_height tall.
Wraps self in a ScrollView.
Calls the given closure and return the result. Read more
Calls the given closure on self.