(I just noticed this topic, sorry for the late answer!)
Actually, that’s not quite true! If the ring buffer you’re writing your logs into implements
std::io::Write, then you can use the
write! macro from the standard library on it, which does not perform any memory allocations.
This method still has a bit of overhead compared to just using a ring buffer of enums (especially float serialization can be tough), but much less than using intermediary string, and this has the advantage that the log receiver does not have to know anything about the logged items since they’re already just strings.
For example, this is what the LV2 Logging spec does, (well, hints towards rather, since LV2 does not require any implementation details) except it does it C-style by just exposing a printf-like function from the host.