Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
cmackenzie1 committed Oct 10, 2023
1 parent d2a49c0 commit 7214bd1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# tracing-ndjson

![Crates.io](https://img.shields.io/crates/v/tracing-ndjson)
[![Rust](https://github.com/cmackenzie1/tracing-ndjson/actions/workflows/rust.yml/badge.svg)](https://github.com/cmackenzie1/tracing-ndjson/actions/workflows/rust.yml)
![docs.rs](https://img.shields.io/docsrs/tracing-ndjson)


A simple library for tracing in new-line delimited JSON format. This library is meant to be used with [tracing](https://github.com/tokio-rs/tracing) as an alternative to the `tracing_subscriber::fmt::json` formatter.

Expand Down Expand Up @@ -29,12 +32,12 @@ fn main() {
.init();

tracing::info!(life = 42, "Hello, world!");
// {"level":"info","timestamp":"2023-10-08T03:30:52Z","target":"default","message":"Hello, world!"}
// {"level":"info","timestamp":"2023-10-10T20:35:26Z","target":"defaults","message":"Hello, world!","life":42}

let span = tracing::info_span!("hello", "request.uri" = "https://example.com");
span.in_scope(|| {
tracing::info!("Hello, world!");
// {"level":"info","timestamp":"2023-10-08T03:34:33Z","target":"defaults","message":"Hello, world!","request.uri":"https://example.com"}
// {"level":"info","timestamp":"2023-10-10T20:35:26Z","target":"defaults","message":"Hello, world!","request.uri":"https://example.com"}
});
}
```
Expand Down

0 comments on commit 7214bd1

Please sign in to comment.