Skip to content

Obtain an owned Record? #696

@tisonkun

Description

@tisonkun

When I'm trying to implement fast/logforth#145 I noticed that Record<'a> has a lifetime argument and thus can be hardly sent to another thread.

In spdlog-rs @SpriteOvO defineds its own Record and RecordOwned to support AsyncSink. spdlog-rs also supports a bridge to this log crate, but it comes with some data loss (https://github.com/SpriteOvO/spdlog-rs/blob/654b440d/spdlog/src/record.rs#L115-L148), mainly the args get resolved and we can't revert it to fmt::Arguments<'a>.

Is there any possible way we get an owned Record? Otherwise it's impossible to implmement:

impl Append for AsyncAppender {
  fn append(&self, record: &Record, ...) -> .. { ... }
}

impl Append for RollingFileAppender {
  fn append(&self, record: &Record, ...) -> .. { ... }
}

... and combine them together.

cc @KodrAus @Thomasdezeeuw

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions