slog
slog copied to clipboard
Make it possible to Clone Records?
At the moment, it is not possible to clone the Record
struct.
Cloning the Record
would be very useful in order to write a Drain
that for example sends the log to a background thread through a channel for later processing.
The slog-async
crate actually does what I described (send the record through a channel), but a good chunk of its source code consists in exactly that: cloning the Record
.
Should the record cloning code not be moved to slog
?
Hmmmm.... That's a good point. I haven't thought about it this way (that slog-async
is effectively doing Clone
. I guess there's probably just one way to do it, so it could be a part of slog
core.
:+1: from me. If you can submit a PR and go through the effort of making sure no backward compat etc. has been broken, then I'm happy to land such a thing (and potentially, but not requried a change in slog-async
to use it).