Skip to content

log: Support structured values #341

@KodrAus

Description

@KodrAus

Feature Request

Crates

tracing-log

Motivation

Large applications may use libraries or components that use a combination of the log crate and tracing. We can support better diagnostics in these applications by making the most of the shared feature-set between log and tracing. That means retaining as much structure as possible when pushing diagnostic data between them.

In rust-lang/log#328 we're tracking the progress of structured logging support in the log crate. One of its stabilization blockers is that it works nicely with tracing.

Proposal

This is a bit of an open question, we've got flexibility on the log side to tweak things as needed for better integration with tracing. Since tracing already makes some concessions to log support (by handling it explicitly in its event macros) I'm guessing we've got a little flexibility on the tracing side too.

I'm proposing we aim for zero-cost structured integration between log and tracing by leveraging the existing hook in the event macros and using the log::kv APIs to translate between them.

Metadata

Metadata

Assignees

Labels

crate/logRelated to the `tracing-log` cratekind/featureNew feature or requestneeds/designAdditional design discussion is required.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions