Skip to content

Commit 4fa1585

Browse files
authored
chore: update readme (#3)
1 parent 7800c4d commit 4fa1585

File tree

5 files changed

+156
-25
lines changed

5 files changed

+156
-25
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ jobs:
2121
RUST_BACKTRACE: 1
2222
steps:
2323
- uses: actions/checkout@v4
24+
- name: Delete rust-toolchain.toml
25+
run: rm rust-toolchain.toml
2426
- uses: Swatinem/rust-cache@v2
2527
- uses: dtolnay/rust-toolchain@master
2628
with:

Cargo.lock

Lines changed: 138 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,13 @@ rust-version = "1.80"
1515
[dependencies]
1616
fastrace = "0.7"
1717
take_mut = "0.2.2"
18-
tracing = { version = "0.1.35", default-features = false, features = [
19-
"std",
20-
"attributes",
21-
] }
22-
tracing-core = "0.1.28"
23-
tracing-subscriber = { version = "0.3.0", default-features = false, features = [
18+
tracing = { version = "0.1", default-features = false, features = ["std"] }
19+
tracing-core = "0.1"
20+
tracing-subscriber = { version = "0.3", default-features = false, features = [
2421
"registry",
2522
"std",
26-
"fmt",
2723
] }
2824

2925
[dev-dependencies]
3026
fastrace = { version = "0.7", features = ["enable"] }
27+
logforth = "0.23"

README.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Add `fastrace-tracing` to your project:
2323
[dependencies]
2424
fastrace = { version = "0.7", features = ["enable"] }
2525
fastrace-tracing = "0.1"
26-
tracing = "0.1"
26+
tracing = { version = "0.1", features = ["log"] }
2727
tracing-subscriber = "0.3"
2828
```
2929

@@ -34,14 +34,17 @@ use fastrace::collector::{Config, ConsoleReporter};
3434
use fastrace::prelude::*;
3535
use tracing_subscriber::layer::SubscriberExt;
3636

37-
// Initialize fastrace.
38-
fastrace::set_reporter(ConsoleReporter, Config::default());
39-
4037
// Set up tokio-tracing with the fastrace compatibility layer.
4138
let subscriber = tracing_subscriber::Registry::default()
4239
.with(fastrace_tracing::FastraceCompatLayer::new());
4340
tracing::subscriber::set_global_default(subscriber).unwrap();
4441

42+
// Initialize fastrace.
43+
fastrace::set_reporter(ConsoleReporter, Config::default());
44+
45+
// Initialize logging.
46+
logforth::stderr().apply();
47+
4548
{
4649
// Create a fastrace root span.
4750
let root = Span::root("my-application", SpanContext::random());
@@ -54,11 +57,11 @@ tracing::subscriber::set_global_default(subscriber).unwrap();
5457
let span = tracing::span!(tracing::Level::INFO, "my_operation");
5558
let _enter = span.enter();
5659

57-
// Events from tokio-tracing will also be captured by fastrace.
60+
// Events from tokio-tracing will be captured by both fastrace and log.
5861
tracing::info!("This will be captured by fastrace");
5962
}
6063

61-
// Don't forget to flush before your application exits.
64+
// Flush any remaining traces before the program exits.
6265
fastrace::flush();
6366
```
6467

rust-toolchain.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[toolchain]
2+
channel = "1.80.0"
3+
components = ["cargo", "rustfmt", "clippy", "rust-analyzer"]

0 commit comments

Comments
 (0)