tracing
tracing copied to clipboard
tracing-log: support `no_std`
This PR adds support for no_std to tracing-log.
I tried to do this as non-intrusively as possible. The biggest issue here was the use of lazy_static! in lib.rs for the Fields, which had to be removed to make it no_std-compatible. I considered various approaches like:
-
reexporting the vendored
lazy_staticfromtracing-coreso thattracing-logcan use is (doing that is kind of messy as the macros would have to be renamed, and it is a relatively big purely private extra API to export), -
adding yet another copy of
lazy_static(seems pretty silly to do), -
constifying all of the necessary methods so that
lazy_staticis not necessary (unfortunately that's not currently possible), -
make it possible to construct a
Fieldin aconst fn, and just construct those directly instead of going through theFieldSet::field.
The last one seemed like the most minimal and straightforward one to do, so that's what I did. And as a bonus this might generate slightly more efficient code since now it doesn't have to go through lazy_static (although in practice it'll probably make no difference).
(It would be nice to also add a job on the CI which will make sure that tracing-log will stay no_std compatible, although that's kinda out-of-scope of this PR.)
Fixes https://github.com/tokio-rs/tracing/issues/1663
Any update on this one @koute?
Any update on this one @koute?
Well, it still needs to be reviewed. (:
@hawkw Need direction on this PR, do we want to merge/do we need additional changes if so?
Just want to chime in with my support: Thanks for creating this PR. It would be a huge help to me if this issue were resolved. If there's anything a stranger can do to breathe life back into this PR, let me know.