mozilla-services / common-rs

Common utilities for Mozilla server side apps
Mozilla Public License 2.0
3 stars 9 forks source link

Remove dependency on chrono #41

Closed birdsarah closed 2 years ago

birdsarah commented 2 years ago

For context on motivation.

chrono is unmaintained and has a security vulnerability with no fix. Downstream dependencies have updated themselves to move off chrono.

The use of chrono in this crate is very limited (just creating a timestamp) which time std::SystemTime can easily handle.

So this PR switches chrono to std::SystemTime for this crate and bumps the dependency versions so that chrono isn't in the dependency chain.

Thanks for the assist @pjenvey

birdsarah commented 2 years ago

To use this upgraded code on our local codebase, we needed to make one change:

https://github.com/mozilla-services/cjms/pull/24/commits/a6f511a1a49c82379e577a4de7c79d3fd56631b8#diff-e31f6bd15713b5338872af199c21f33ff190d3c886a526b8677c048fe3a33e8cR10

pub fn init_tracing<Sink>(service_name: &str, log_level: &str, sink: Sink)
where
-    Sink: for<'a> MakeWriter + Send + Sync + 'static,
+    Sink: for<'a> MakeWriter<'a> + Send + Sync + 'static,
{
    let env_filter = EnvFilter::new(log_level);