Highlight code blocks inside Readme

This commit is contained in:
Romain Ardiet 2018-11-29 12:01:41 +01:00
parent ab587c98e4
commit e83d3b67bb

View file

@ -14,18 +14,24 @@ Note: Tested only in Linux
First, add the following to your `Cargo.toml`
[dependencies]
logwatcher = "0.1"
```toml
[dependencies]
logwatcher = "0.1"
```
Add to your code,
extern crate logwatcher;
use logwatcher::LogWatcher;
```rust
extern crate logwatcher;
use logwatcher::LogWatcher;
```
Register the logwatcher, pass a closure and watch it!
let mut log_watcher = LogWatcher::register("/var/log/check.log".to_string()).unwrap();
```rust
let mut log_watcher = LogWatcher::register("/var/log/check.log".to_string()).unwrap();
log_watcher.watch(&|line: String| {
log_watcher.watch(&|line: String| {
println!("Line {}", line);
});
});
```