solink-tracing-flat-json
This is an open source library that can be used with tracing to log as flattened JSON:
use SolinkJsonFormat;
let log_to_file = layer
.event_format
.fmt_fields;
registry.with.init;
This will serialize a timestamp, all variables in the event, the name of the current span, and all variables in the current and all parent spans.
An example like this:
async
async
async
Will produce output like:
{"timestamp":"2024-06-18T21:17:44.902137000Z","level":"INFO","message":"Hello from b","z":94,"span":"b","y":42,"x":42}