Highlight code blocks inside Readme
This commit is contained in:
parent
ab587c98e4
commit
e83d3b67bb
1 changed files with 14 additions and 8 deletions
20
README.md
20
README.md
|
|
@ -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`
|
||||||
|
|
||||||
[dependencies]
|
```toml
|
||||||
logwatcher = "0.1"
|
[dependencies]
|
||||||
|
logwatcher = "0.1"
|
||||||
|
```
|
||||||
|
|
||||||
Add to your code,
|
Add to your code,
|
||||||
|
|
||||||
extern crate logwatcher;
|
```rust
|
||||||
use logwatcher::LogWatcher;
|
extern crate logwatcher;
|
||||||
|
use logwatcher::LogWatcher;
|
||||||
|
```
|
||||||
|
|
||||||
Register the logwatcher, pass a closure and watch it!
|
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);
|
println!("Line {}", line);
|
||||||
});
|
});
|
||||||
|
```
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue