Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In some cases, users may wish to erase the type of a `Subscriber` implementation, such as when it is dynamically constructed from a complex parameterized type. When doing so, it's important to ensure that all trait methods with default implementations are properly forwarded to the inner erased type. For example, if the type does not implement `try_close`, but the inner erased subscriber does, then the the subscriber will not be notified when spans close — which could result in a memory leak. To avoid potential footguns resulting from users implementing type-erased subscribers incorrectly, this branch adds a new `impl Subscriber for Box<dyn Subscriber + Send + Sync + 'static>` in `tracing-core`. This is also somewhat more ergonomic than any solution in another crate, since the implementation is for `Box<dyn Subscriber + ...>` directly, rather than some `BoxedSubscriber` newtype.
- Loading branch information