Skip to content

[Feature]: Add support for custom error handlers + make SdkLogRecord::new public again #2992

@mdecimus

Description

@mdecimus

Related Problems?

Hi,

We just migrated Stalwart from opentelemetry 0.25 to 0.29 and noticed two issues that I briefly explained in #2260:

  • We use our custom logging backend rather than tracing and global::set_error_handler has been removed.
  • We also use run own own span, log and metrics export task and the Default trait has been removed from SdkLogRecord. In order to be able to generate a SdkLogRecord we now need to do SdkLoggerProvider::builder().build().logger("stalwart").create_log_record() which is not awful but it would be much nicer if SdkLogRecord::new was made public or the Default trait was added.

Describe the solution you'd like:

I propose to:

  • Re-implement global::set_error_handler (or similar) and place it behind a Cargo feature, which will be disabled by default. I agree that most users will use tracing.
  • Make SdkLogRecord::new public or add the Default trait to SdkLogRecord.

I'm not familiar with the internals of this crate but if you prefer I can submit a PR for these.

Considered Alternatives

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions