https://github.com/eopb/tide-tracing
A simple middleware for tide using the tracing crate for logging.
https://github.com/eopb/tide-tracing
Last synced: 8 months ago
JSON representation
A simple middleware for tide using the tracing crate for logging.
- Host: GitHub
- URL: https://github.com/eopb/tide-tracing
- Owner: eopb
- License: mit
- Created: 2020-07-26T17:51:10.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-10-23T12:46:58.000Z (almost 3 years ago)
- Last Synced: 2024-12-17T04:16:35.529Z (over 1 year ago)
- Language: Rust
- Homepage:
- Size: 548 KB
- Stars: 37
- Watchers: 2
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# tide-tracing
[](https://crates.io/crates/tide-tracing)
[](https://crates.io/crates/tide-tracing)
[](https://docs.rs/tide-tracing/)
[](https://crates.io/crates/tide-tracing)
A simple middleware for [`tide`](https://github.com/http-rs/tide) using the [`tracing`](https://github.com/tokio-rs/tracing) crate for logging.
[](https://github.com/ethanboxx/tide-tracing/blob/master/examples/main.rs)
## Why
[`tide`](https://github.com/http-rs/tide) uses [`log`](https://github.com/rust-lang/log) in its [default logging middleware](https://docs.rs/tide/latest/tide/log/struct.LogMiddleware.html).
When using [`tracing-log`](https://github.com/tokio-rs/tracing/tree/master/tracing-log) most of the information from tide is lost.
This crate provides a middleware that exposes all that information to [`tracing`](https://github.com/tokio-rs/tracing) directly while also improving the structure of the logs using [`span!`](https://docs.rs/tracing/latest/tracing/span/index.html).
`tide-tracing` uses [opentelemetry conventional trace field names](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/http.md#common-attributes) by default.
## Docs
- [API docs](https://docs.rs/tide-tracing/)
- [Example](https://github.com/ethanboxx/tide-tracing/blob/master/examples/main.rs)