Skip to content

Commit 975b44a

Browse files
committed
Remove code from README.
Just link to examples. Issue #2
1 parent 0ada400 commit 975b44a

File tree

1 file changed

+5
-59
lines changed

1 file changed

+5
-59
lines changed

README.md

Lines changed: 5 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -39,67 +39,13 @@ places of it might be confusing.
3939

4040
See `examples` directory.
4141

42-
The simplest way to convert existing project to use `slog-rs`+`slog-envlogger` is:
42+
The simplest way to convert existing project to use `slog-rs`+`slog-envlogger`
43+
is shown in
44+
[`simple` example](https://github.com/slog-rs/envlogger/blob/master/examples/simple.rs)
4345

44-
```rust
45-
fn main() {
46-
slog_envlogger::init().unwrap();
47-
48-
error!("error");
49-
info!("info");
50-
trace!("trace");
51-
}
52-
```
53-
54-
More proper (and powerful) version would be:
55-
56-
```rust
57-
fn main() {
58-
let term = slog_term::stderr();
59-
let drain = slog_envlogger::new(term);
60-
61-
let root_logger = drain.into_logger(o!("build" => "8jdkj2df", "version" => "0.1.5"));
62-
63-
slog_stdlog::set_logger(root_logger.clone()).unwrap();
64-
65-
slog_error!(root_logger, "slog error");
66-
error!("log error");
67-
slog_info!(root_logger, "slog info");
68-
info!("log info");
69-
slog_trace!(root_logger, "slog trace");
70-
trace!("log trace");
71-
}
72-
```
46+
For more proper (and powerful) version see
47+
[`proper` example](https://github.com/slog-rs/envlogger/blob/master/examples/proper.rs)
7348

7449
Using `slog-stdlog` scopes you can make parts of the code log additional information (see [`scopes` example][scopes]):
7550

7651
[scopes]: https://github.com/dpc/slog-envlogger/blob/master/examples/scopes.rs
77-
78-
```rust
79-
fn main() {
80-
slog_envlogger::init().unwrap();
81-
82-
error!("log error");
83-
84-
slog_stdlog::scope(
85-
slog_stdlog::with_current_logger(|l| l.new(o!("scope-extra-data" => "data"))),
86-
|| foo()
87-
);
88-
89-
trace!("log trace");
90-
}
91-
92-
fn foo() {
93-
info!("log info inside foo");
94-
95-
// scopes can be nested!
96-
slog_stdlog::scope(
97-
slog_stdlog::with_current_logger(|l| l.new(o!("even-more-scope-extra-data" => "data2"))),
98-
|| bar()
99-
);
100-
}
101-
102-
fn bar() {
103-
info!("log info inside bar");
104-
}
105-
```

0 commit comments

Comments
 (0)