chore: Fix simple example and doc

This commit is contained in:
Jill 2022-05-19 12:45:03 +02:00
parent 7e8f445967
commit 921ea05f89
Signed by untrusted user: KokaKiwi
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,9 +40,7 @@ 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())
.with(
tracing_subscriber::fmt::layer().with_filter( tracing_subscriber::fmt::layer().with_filter(
tracing_subscriber::filter::Targets::new() tracing_subscriber::filter::Targets::new()
.with_default(tracing::Level::DEBUG) .with_default(tracing::Level::DEBUG)
@ -52,6 +50,10 @@ fn setup_logging() {
.with_target("tokio_tower", tracing::Level::TRACE) .with_target("tokio_tower", tracing::Level::TRACE)
.with_target("mio", tracing::Level::TRACE), .with_target("mio", tracing::Level::TRACE),
), ),
) );
.init();
#[cfg(tokio_unstable)]
let registry = registry.with(console_subscriber::spawn());
registry.init();
} }