Logger with smart widget for the tui crate

Build Status dependency status Build examples

Documentation

Documentation

Demo

Features

Smart Widget

Smart widget consists of two widgets. Left is the target selector widget and on the right side the logging messages view scrolling up. The target selector widget can be hidden/shown during runtime via key command.

The target selector widget looks like this:

alt text

It controls:

The target selector widget consists of two columns:

Event Dispatcher

In order to allow above mentioned control via key events, a dispatcher has been integrated. The dispatcher as module is independent from the backend, but the widgets are in the moment specifically only for termion. The event handler queue is dynamically built during drawing of the tui elements. This allows an easy link between complex ui layouts and the embedded widgets. This could even be used for mouse events, but this is not yet implemented.

Smart Widget Key Commands

| KEY | ACTION |:------:|-----------------------------------------------------------| | h | Toggles target selector widget hidden/visible | f | Toggle focus on the selected target only | UP | Select previous target in target selector widget | DOWN | Select next target in target selector widget | LEFT | Reduce SHOWN (!) log messages by one level | RIGHT| Increase SHOWN (!) log messages by one level | - | Reduce CAPTURED (!) log messages by one level | + | Increase CAPTURED (!) log messages by one level | SPACE| Toggles hiding of targets, which have logfilter set to off

Basic usage to initialize logger-system:

```

[macro_use]

extern crate log;

use tui_logger::*;

fn main() { // Early initialization of the logger

// Set max_log_level to Trace
init_logger(log::LevelFilter::Trace).unwrap();

// Set default level for unknown targets to Trace
set_default_level(log::LevelFilter::Trace);

// code....

} ```

For use of the widget please check examples/demo.rs

THANKS TO