Closed KodrAus closed 7 months ago
I did start looking at slog-rs/stdlog
and found we'd need to buffer the entire set of key-value pairs from slog
before we'd be able to use them as a Source
in log
. This is because log
's Source
is borrowing, so you need to be able to get a (Key<'v>, Value<'v>)
from a &'v Source
. I think we can improve this by supporting some way to stash owned values in Key<'v>
and Value<'v>
, so we could at least produce (Key<'static>, Value<'static>)
from any arbitrary &'_ Source
. That's an API addition so isn't blocking.
Proper support in tracing-log
will depend on something like https://github.com/tokio-rs/tracing/pull/2048 for proper support, otherwise it'll need to be integrated into the event macros like log
support currently is. I can't see the tracing
maintainers wanting to integrate with log
so directly for much longer though.
If they end up going down the valuable
route as their value data model then we should be able to support conversion to and from it. I've spent some time integrating with valuable
in the past.
For opentelemetry
, they have a value type defined as a proto: https://docs.rs/opentelemetry/latest/opentelemetry/logs/enum.AnyValue.html
I've also written a serde::Serializer
in the past that converts any serde::Serialize
into an AnyValue
, and done the same for sval
too so there shouldn't be any trouble integrating there.
So there is something we can potentially improve for slog
, but I didn't find any blocking concerns. Which means, I think we're ready to release 🙂
Now that #613 is merged we have a "stable" API on the main branch that's ready to release. Before we do that, I'd like to run over any related projects we should look at and see whether there are any blocking API concerns (non-blocking additions in
log
for better support would be ok) we can discover at this last-responsible-moment.Off the top of my head:
Any others? This isn't a list of all projects that could use
log
's structured logging support, just those that are likely to need substantial work to integrate and may reveal any design issues.