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` First, add the following to your `Cargo.toml`
```toml
[dependencies] [dependencies]
logwatcher = "0.1" logwatcher = "0.1"
```
Add to your code, Add to your code,
```rust
extern crate logwatcher; extern crate logwatcher;
use logwatcher::LogWatcher; use logwatcher::LogWatcher;
```
Register the logwatcher, pass a closure and watch it! Register the logwatcher, pass a closure and watch it!
```rust
let mut log_watcher = LogWatcher::register("/var/log/check.log".to_string()).unwrap(); 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); println!("Line {}", line);
}); });
```