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
```
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)
```shell

View file

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