chore: Fix simple example and doc

This commit is contained in:
Jill 2022-05-19 12:45:03 +02:00
parent 7e8f445967
commit 921ea05f89
No known key found for this signature in database
GPG key ID: 09A5A2688F13FAC1
2 changed files with 22 additions and 14 deletions

View file

@ -10,6 +10,12 @@ This example is meant to show basic service-based IMAP server with boitalettres
$ cargo run --example simple $ cargo run --example simple
``` ```
If you want to trace this `simple` example with the [`tokio-console`](https://github.com/tokio-rs/console/tree/main/tokio-console) utility, run:
```shell
$ RUSTFLAGS="tokio_unstable" cargo run --example simple --features "tokio/tracing"
```
- [Basic python testing script](../scripts/test_imap.py) - [Basic python testing script](../scripts/test_imap.py)
```shell ```shell

View file

@ -40,18 +40,20 @@ async fn main() -> Result<()> {
fn setup_logging() { fn setup_logging() {
use tracing_subscriber::prelude::*; use tracing_subscriber::prelude::*;
tracing_subscriber::registry() let registry = tracing_subscriber::registry().with(
.with(console_subscriber::spawn()) tracing_subscriber::fmt::layer().with_filter(
.with( tracing_subscriber::filter::Targets::new()
tracing_subscriber::fmt::layer().with_filter( .with_default(tracing::Level::DEBUG)
tracing_subscriber::filter::Targets::new() .with_target("boitalettres", tracing::Level::TRACE)
.with_default(tracing::Level::DEBUG) .with_target("simple", tracing::Level::TRACE)
.with_target("boitalettres", tracing::Level::TRACE) .with_target("tower", tracing::Level::TRACE)
.with_target("simple", tracing::Level::TRACE) .with_target("tokio_tower", tracing::Level::TRACE)
.with_target("tower", tracing::Level::TRACE) .with_target("mio", tracing::Level::TRACE),
.with_target("tokio_tower", tracing::Level::TRACE) ),
.with_target("mio", tracing::Level::TRACE), );
),
) #[cfg(tokio_unstable)]
.init(); let registry = registry.with(console_subscriber::spawn());
registry.init();
} }