An alternative debug view for gyscos/cursive using emabee/flexi_logger
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
Johannes Wünsche 2fff51a50f
Remove badges from Cargo.toml
4 days ago
.github Remove travis & Update README 4 days ago
assets Add flexi logger debug view implementation 2 years ago
examples Add Trait to allow for customization 11 months ago
scripts Remove travis & Update README 4 days ago
src Implement Indentable on FlexiLoggerView 11 months ago
.editorconfig Add flexi logger debug view implementation 2 years ago
.gitignore Add flexi logger debug view implementation 2 years ago
Cargo.toml Remove badges from Cargo.toml 4 days ago
LICENSE Add flexi logger debug view implementation 2 years ago
README.md Remove travis & Update README 4 days ago

README.md

Welcome to cursive-flexi-logger-view 👋

stable build nightly build crates.io Docs.rs GitHub PRs Welcome
An alternative debug view for gyscos/cursive using emabee/flexi_logger


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. Have a look at the demo below to see how it looks.

How does it look like? demo terminalizer

Expand to view flexi-logger-view demo

Usage

Simply add to your Cargo.toml

[dependencies]
cursive-flexi-logger-view = "^0"

Using the FlexiLoggerView

To create a FlexiLoggerView you first have to register the cursive_flexi_logger as a LogTarget in flexi_logger. After the flexi_logger has started, you may create a FlexiLoggerView instance and add it to cursive.

use cursive::Cursive;
use cursive_flexi_logger_view::FlexiLoggerView;
use flexi_logger::{Logger, LogTarget};

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::with_env_or_str("trace")
        .log_target(LogTarget::FileAndWriter(
            cursive_flexi_logger_view::cursive_flexi_logger(&siv),
        ))
        .directory("logs")
        .suppress_timestamp()
        .format(flexi_logger::colored_with_thread)
        .start()
        .expect("failed to initialize logger!");

    siv.add_layer(FlexiLoggerView::scrollable()); // omit `scrollable` to remove scrollbars

    log::info!("test log message");
    siv.run();
}

Look into the documentation for a detailed explanation on the API.

Troubleshooting

If you find any bugs/unexpected behaviour or you have a proposition for future changes open an issue describing the current behaviour and what you expected.

Development cargo test

Running the tests

Just run

$ cargo test

to execute all available tests.

shields.io endpoints

shields.io endpoints are generated inside the ./target/shields folder. They are used in this README.

Authors

Fin Christensen

:octocat: @fin-ger
:elephant: @fin_ger@weirder.earth
:bird: @fin_ger_github


Johannes Wünsche

:octocat: @jwuensche
:elephant: @fredowald@mastodon.social
:bird: @Fredowald

Show your support

Give a if this project helped you!