You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use a visitor pattern instead of FormattedFields (#12)
This changes a lot of the insides of the crate, but the API is mostly
the same. While the visitor pattern is a bit more verbose, it's also
more flexible and allows for more customization in the future.
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.
9
8
9
+
The goal of this crate is to provide a flattend JSON event, comprising of fields from the span attributes and event fields, with customizeable field names and timestamp formats.
10
+
10
11
## Features
11
12
12
13
- Configurable field names for `target`, `message`, `level`, and `timestamp`.
13
-
- Configurable timestamp formats such as RFC3339, UNIX timestamp, or any custom chrono format.
14
-
- Captures all span attributes and event fields in the root of the JSON object.
14
+
- Configurable timestamp formats
15
+
- RFC3339 (`2023-10-08T03:30:52Z`),
16
+
- RFC339Nanos (`2023-10-08T03:30:52.123456789Z`)
17
+
- Unix timestamp (`1672535452`)
18
+
- UnixMills (`1672535452123`)
19
+
- Captures all span attributes and event fields in the root of the JSON object. Collisions will result in overwriting the existing field.
20
+
21
+
## Limitations
22
+
23
+
- When flattening span attributes and event fields, the library will overwrite any existing fields with the same name, including the built-in fields such as `target`, `message`, `level`, `timestamp`, `file`, and `line`.
24
+
- Non-determistic ordering of fields in the JSON object. ([JSON objects are unordered](https://www.json.org/json-en.html))
25
+
- Currently only logs to stdout. (PRs welcome!)
15
26
16
27
## Usage
17
28
@@ -20,24 +31,24 @@ Add this to your `Cargo.toml`:
0 commit comments