test-log icon indicating copy to clipboard operation
test-log copied to clipboard

Support `no_std`

Open TTWNO opened this issue 8 months ago • 8 comments

I'm writing a library that needs to be tested inside no_std environments. Since tracing, and tracing-subscriber do not inherently require std, it would be convenient to be able to use this crate to do so.

I've made some trivial changes, like importing alloc::{string::String, vec::Vec}, but the more important change is that I've switched std::env::var_os with core::option_env, which resolves an optional environment variable at compile time. I'm fine feature gating the std::env::var_os call behind an std feature if that is more acceptable for you.

Some things to consider:

  • You may want to enable std_instead_of_alloc to identify types up front that can be easily used without std
  • You may want an std flag to enable more features available via std that are not required for the base crate to work.

Thanks for all your work; I really enjoy this crate!

—Tait

TTWNO avatar Jun 05 '24 17:06 TTWNO