Replace `neqo_common::log` with `log` crate
neqo* currently uses neqo_common::log for all things logging. It is a wrapper around the log crate.
What is the benefit of using neqo_common::log over using the log crate directly? From what I can tell:
neqo_common::logdoes not require explicit instantiation of the logger (e.g. viaenv_logger::init) but instead tries to initialize on each log invocation. https://github.com/mozilla/neqo/blob/c209c439e2aea408594273f6f1c423bbfe723f4f/neqo-common/src/log.rs#L84-L90- Uses elapsed time instead of absolute time https://github.com/mozilla/neqo/blob/c209c439e2aea408594273f6f1c423bbfe723f4f/neqo-common/src/log.rs#L69-L71
Are the benefits worth a custom way of logging? Should a library instantiate a logger instead of the conventional instantiation by the calling binary?
Related, other Mozilla code using log:
https://searchfox.org/mozilla-central/search?q=%5Elog+%3D&path=*Cargo.toml&case=true®exp=true
I'd be OK with removing this.
There are some special things neqo_common::log allows, e.g.,
https://github.com/mozilla/neqo/blob/9f0a86db7f125d731cd10816e57728597d8437b5/neqo-crypto/src/agent.rs#L898-L902
Can we do this with log?
So I worked on this a bit in #2291. I do think we need a wrapper of some sort like we have in neqo-common::log, because otherwise we'd need to initialize env_logger in every single test, which is a pain.
Agreed. I didn't think of env_logger instantiation in unit tests. Sorry about that.
OK. I will leave neqo-common::log in place w/some changes.