Skip to content

Commit b9b3160

Browse files
committed
doc: update README example
1 parent 8ae7319 commit b9b3160

File tree

1 file changed

+5
-19
lines changed

1 file changed

+5
-19
lines changed

README.md

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,32 +9,24 @@ tracing-cloudwatch is a custom tracing-subscriber layer that sends your applicat
99
feature `rusoto` required
1010

1111
```rust
12-
use rusoto_core::Region;
1312
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
1413

1514
#[tokio::main]
1615
async fn main() {
17-
let cw_client = rusoto_logs::CloudWatchLogsClient::new(Region::ApNortheast1);
16+
let cw_client = rusoto_logs::CloudWatchLogsClient::new(rusoto_core::Region::ApNortheast1);
1817

1918
tracing_subscriber::registry::Registry::default()
2019
.with(
2120
tracing_cloudwatch::layer().with_client(
2221
cw_client,
2322
tracing_cloudwatch::ExportConfig::default()
24-
.with_batch_size(1)
23+
.with_batch_size(5)
2524
.with_interval(Duration::from_secs(1))
2625
.with_log_group_name("tracing-cloudwatch")
2726
.with_log_stream_name("stream-1"),
2827
),
2928
)
3029
.init();
31-
32-
start().await;
33-
}
34-
35-
#[tracing::instrument()]
36-
async fn start() {
37-
tracing::info!("Starting...");
3830
}
3931
```
4032

@@ -43,9 +35,10 @@ async fn start() {
4335
feature `awssdk` required
4436

4537
```rust
38+
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
39+
4640
#[tokio::main]
4741
async fn main() {
48-
use tracing_subscriber::{filter, fmt, layer::SubscriberExt, util::SubscriberInitExt};
4942
let config = aws_config::load_from_env().await;
5043
let cw_client = aws_sdk_cloudwatchlogs::Client::new(&config);
5144

@@ -54,20 +47,13 @@ async fn main() {
5447
tracing_cloudwatch::layer().with_client(
5548
cw_client,
5649
tracing_cloudwatch::ExportConfig::default()
57-
.with_batch_size(1)
50+
.with_batch_size(5)
5851
.with_interval(Duration::from_secs(1))
5952
.with_log_group_name("tracing-cloudwatch")
6053
.with_log_stream_name("stream-1"),
6154
),
6255
)
6356
.init();
64-
65-
start().await;
66-
}
67-
68-
#[tracing::instrument()]
69-
async fn start() {
70-
tracing::info!("Starting...");
7157
}
7258
```
7359

0 commit comments

Comments
 (0)