Skip to content

core: remove Collect default impls for 0.2 #1262

Open
@hawkw

Description

@hawkw

Feature Request

Crates

  • tracing-core

Motivation

The Collect trait currently has several methods with default implementations that return an Option or some other "empty" or "default" type. In many cases, this isn't because it makes sense for those methods to be optional, but because they were added after v0.1.0 was released and making them mandatory would have been a breaking change. This can sometimes cause issues when implementations forget to override the default implementations and miss out on important behavior.

Proposal

For 0.2, we should consider making some of these methods mandatory so that implementations can't overlook them. In particular:

  • Collect::max_level_hint probably shouldn't have a default None return value (and we should maybe get rid of the Option? is it actually worth differentiating between "may enable up to TRACE" and "just doesn't care about levels at all"?)
  • Collect::current_span defaults to returning span::Current::unknown. Saying "I don't know what the current span is" should be an explicit decision on behalf of the collector in 0.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    crate/coreRelated to the `tracing-core` crategood first issueGood for newcomerskind/featureNew feature or requestmeta/breakingThis is a breaking change, and should wait until the next breaking release.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions