From b2601b14883e59f88dcc2d4d1d0cb48d47cce012 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Fri, 30 Dec 2022 00:21:13 +0000 Subject: [PATCH] Bug 1806766 - Update env_logger to 0.9.3. r=emilio,supply-chain-reviewers Differential Revision: https://phabricator.services.mozilla.com/D165711 --- Cargo.lock | 18 +++---- supply-chain/audits.toml | 5 ++ .../rust/env_logger/.cargo-checksum.json | 2 +- third_party/rust/env_logger/Cargo.toml | 48 ++++++++++++----- third_party/rust/env_logger/LICENSE-MIT | 2 - third_party/rust/env_logger/README.md | 12 ++--- third_party/rust/env_logger/src/filter/mod.rs | 2 +- .../src/fmt/humantime/extern_impl.rs | 2 +- third_party/rust/env_logger/src/fmt/mod.rs | 2 +- .../rust/env_logger/src/fmt/writer/mod.rs | 2 +- .../src/fmt/writer/termcolor/extern_impl.rs | 52 +++++++++++++------ .../src/fmt/writer/termcolor/shim_impl.rs | 1 - third_party/rust/env_logger/src/lib.rs | 12 ++--- 13 files changed, 99 insertions(+), 61 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fe67e3023945..74c71b818a00 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -71,7 +71,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5e9dd62f37dea550caf48c77591dc50bd1a378ce08855be1a0c42a97b7550fb" dependencies = [ "android_log-sys", - "env_logger 0.9.0", + "env_logger 0.9.3", "log", "once_cell", ] @@ -1540,14 +1540,14 @@ dependencies = [ name = "env_logger" version = "0.8.999" dependencies = [ - "env_logger 0.9.0", + "env_logger 0.9.3", ] [[package]] name = "env_logger" -version = "0.9.0" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3" +checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7" dependencies = [ "atty", "humantime", @@ -2040,7 +2040,7 @@ name = "gecko_logger" version = "0.1.0" dependencies = [ "app_services_logger", - "env_logger 0.9.0", + "env_logger 0.9.3", "lazy_static", "log", ] @@ -2295,7 +2295,7 @@ dependencies = [ "bincode", "chrono", "crossbeam-channel", - "env_logger 0.9.0", + "env_logger 0.9.3", "flate2", "log", "once_cell", @@ -3604,7 +3604,7 @@ version = "0.6.3" source = "git+https://github.com/mozilla/neqo?tag=v0.6.3#4fe628bb911e4437169d974baa628c159e96f879" dependencies = [ "chrono", - "env_logger 0.9.0", + "env_logger 0.9.3", "lazy_static", "log", "qlog", @@ -3958,7 +3958,7 @@ version = "0.1.4" dependencies = [ "byteorder", "core-foundation", - "env_logger 0.9.0", + "env_logger 0.9.3", "lazy_static", "libloading", "log", @@ -4955,7 +4955,7 @@ name = "smoosh" version = "0.1.0" dependencies = [ "bumpalo", - "env_logger 0.9.0", + "env_logger 0.9.3", "jsparagus", "log", ] diff --git a/supply-chain/audits.toml b/supply-chain/audits.toml index c595f122f1b6..e5651ff4a9d1 100644 --- a/supply-chain/audits.toml +++ b/supply-chain/audits.toml @@ -538,6 +538,11 @@ who = "Mike Hommey " criteria = "safe-to-deploy" delta = "0.6.0 -> 0.6.1" +[[audits.env_logger]] +who = "Mike Hommey " +criteria = "safe-to-deploy" +delta = "0.9.0 -> 0.9.3" + [[audits.extend]] who = "Ben Dean-Kawamura " criteria = "safe-to-deploy" diff --git a/third_party/rust/env_logger/.cargo-checksum.json b/third_party/rust/env_logger/.cargo-checksum.json index ae346af10161..2f5f8252f6e8 100644 --- a/third_party/rust/env_logger/.cargo-checksum.json +++ b/third_party/rust/env_logger/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"CHANGELOG.md":"34c3abc5bfaeb865e9b901c245f7e41f02a96b6be50beef5302458bff548ef3c","Cargo.toml":"ee8ec2750c4a2c13b1140b72a17355ddd7496f5636e9694d7648fd4d4ff23151","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"534d72fab83eaa93e0e61e3d092b888681e4705c77e568e4acad6d42993278ed","src/filter/mod.rs":"1df1659ebe5815119999a7f49dadb1c69d703acd6fad69a29574470aa1dd3533","src/filter/regex.rs":"bdf875bac25e089e1e462f5dd01a88678067c24118ecd6268561c6a6af39747d","src/filter/string.rs":"fac54d51189fc0b5d2bff334b7a7e465177b431e3428299e345e1f90062d832e","src/fmt/humantime/extern_impl.rs":"f3087b29eedb8b4d5573621ad206e48a2eac72a77277be3b0e631d7dc9fb7a2e","src/fmt/humantime/mod.rs":"f4111c26cf2ffb85c1d639bd7674d55af7e1736e7e98c52f7be3070046a3253f","src/fmt/humantime/shim_impl.rs":"cce9a252abd5952fa109a72b1dfb85a593d237e22606b2b608a32c69184560e9","src/fmt/mod.rs":"6256c12a661c471c2e8e4c3cb21a9a19bf9da793ae44addbbe059a056d5fa964","src/fmt/writer/atty.rs":"09d14097dee61492828daaabdbde9f43251e2cb32e79d66c1c0e63f317761704","src/fmt/writer/mod.rs":"960d9bdeb356b555d32269c6a2f68252c0553078d0c2b7915fdaf98842ef4ef3","src/fmt/writer/termcolor/extern_impl.rs":"839b8bf043939f3f22a6cd21c94e339149e5d0578a9b40fa8ca4fbe574573475","src/fmt/writer/termcolor/mod.rs":"a790f9391a50cd52be6823e3e55942de13a8d12e23d63765342ae9e8dd6d091c","src/fmt/writer/termcolor/shim_impl.rs":"9e9997823434d6741934ddeb5f4354c7da5083cee1e9dda997b4c6ccb31f9842","src/lib.rs":"2c97b9d898197b5b8f2a62c181f4d3ded0584b4548a888991e5fbe61caec5fa2","tests/init-twice-retains-filter.rs":"be5cd2132342d89ede1f5c4266173bb3c4d51cc22a1847f133d299a1c5430ccb","tests/log-in-log.rs":"29fecc65c1e0d1c22d79c97e7ca843ad44a91f27934148d7a05c48899a3f39d8","tests/log_tls_dtors.rs":"7320667d774a9b05037f7bf273fb2574dec0705707692a9cd2f46f4cd5bc68dd","tests/regexp_filter.rs":"a84263c995b534b6479a1d0abadf63f4f0264958ff86d9173d6b2139b82c4dc5"},"package":"0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3"} \ No newline at end of file +{"files":{"CHANGELOG.md":"34c3abc5bfaeb865e9b901c245f7e41f02a96b6be50beef5302458bff548ef3c","Cargo.toml":"a91f488aed0df3b4a1ddc1558f2b2fd05a543f9a37ce28e47548f8d9269ed979","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","README.md":"c126e3dffb9c9e40c9355b5b0261ca84aa72425c5819bbe13abc40a161c51c78","src/filter/mod.rs":"92e7fd89ef1d5d46851de394a10349230045cb1e97f552f09f42031f372ab3dd","src/filter/regex.rs":"bdf875bac25e089e1e462f5dd01a88678067c24118ecd6268561c6a6af39747d","src/filter/string.rs":"fac54d51189fc0b5d2bff334b7a7e465177b431e3428299e345e1f90062d832e","src/fmt/humantime/extern_impl.rs":"97e0a128275c086b02760a33c22db8524f005994ebb1318a6ac582fd51cf444a","src/fmt/humantime/mod.rs":"f4111c26cf2ffb85c1d639bd7674d55af7e1736e7e98c52f7be3070046a3253f","src/fmt/humantime/shim_impl.rs":"cce9a252abd5952fa109a72b1dfb85a593d237e22606b2b608a32c69184560e9","src/fmt/mod.rs":"eb28817c0db5ed729f516927b981d0833cc3fe8bd2cf48256e03a04400d763df","src/fmt/writer/atty.rs":"09d14097dee61492828daaabdbde9f43251e2cb32e79d66c1c0e63f317761704","src/fmt/writer/mod.rs":"f3fb4adc740a1d9057bd398d751a9af24dead7ac108a8e2c571567778ce0f23e","src/fmt/writer/termcolor/extern_impl.rs":"4f02bdca6ad627856af1ac2eef0813104bd383685a2ff87983da9f7dee8261e3","src/fmt/writer/termcolor/mod.rs":"a790f9391a50cd52be6823e3e55942de13a8d12e23d63765342ae9e8dd6d091c","src/fmt/writer/termcolor/shim_impl.rs":"8e6e7d40782b14e33c6b75b81899a612549c2c7937ce28b48cdc60e1e3f8b855","src/lib.rs":"921561bf8d4efad4ab8938b36bc14e277968bfc364d131203822e64eb6e8265e","tests/init-twice-retains-filter.rs":"be5cd2132342d89ede1f5c4266173bb3c4d51cc22a1847f133d299a1c5430ccb","tests/log-in-log.rs":"29fecc65c1e0d1c22d79c97e7ca843ad44a91f27934148d7a05c48899a3f39d8","tests/log_tls_dtors.rs":"7320667d774a9b05037f7bf273fb2574dec0705707692a9cd2f46f4cd5bc68dd","tests/regexp_filter.rs":"a84263c995b534b6479a1d0abadf63f4f0264958ff86d9173d6b2139b82c4dc5"},"package":"a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7"} \ No newline at end of file diff --git a/third_party/rust/env_logger/Cargo.toml b/third_party/rust/env_logger/Cargo.toml index b91eddb65ef4..bf08d9554de9 100644 --- a/third_party/rust/env_logger/Cargo.toml +++ b/third_party/rust/env_logger/Cargo.toml @@ -3,25 +3,36 @@ # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g., crates.io) dependencies +# to registry (e.g., crates.io) dependencies. # -# If you believe there's an error in this file please file an -# issue against the rust-lang/cargo repository. If you're -# editing this file be aware that the upstream Cargo.toml -# will likely look very different (and much more reasonable) +# If you are reading this file be aware that the original Cargo.toml +# will likely look very different (and much more reasonable). +# See Cargo.toml.orig for the original contents. [package] edition = "2018" name = "env_logger" -version = "0.9.0" -authors = ["The Rust Project Developers"] -include = ["src/**/*", "tests", "LICENSE-*", "README.md", "CHANGELOG.md"] -description = "A logging implementation for `log` which is configured via an environment\nvariable.\n" +version = "0.9.3" +include = [ + "src/**/*", + "tests", + "LICENSE-*", + "README.md", + "CHANGELOG.md", +] +description = """ +A logging implementation for `log` which is configured via an environment +variable. +""" documentation = "https://docs.rs/env_logger" readme = "README.md" -keywords = ["logging", "log", "logger"] +keywords = [ + "logging", + "log", + "logger", +] categories = ["development-tools::debugging"] -license = "MIT/Apache-2.0" +license = "MIT OR Apache-2.0" repository = "https://github.com/env-logger-rs/env_logger/" [[test]] @@ -39,6 +50,7 @@ harness = false [[test]] name = "init-twice-retains-filter" harness = false + [dependencies.atty] version = "0.2.5" optional = true @@ -53,13 +65,21 @@ features = ["std"] [dependencies.regex] version = "1.0.3" -features = ["std", "perf"] +features = [ + "std", + "perf", +] optional = true default-features = false [dependencies.termcolor] -version = "1.0.2" +version = "1.1.1" optional = true [features] -default = ["termcolor", "atty", "humantime", "regex"] +default = [ + "termcolor", + "atty", + "humantime", + "regex", +] diff --git a/third_party/rust/env_logger/LICENSE-MIT b/third_party/rust/env_logger/LICENSE-MIT index 39d4bdb5acd3..31aa79387f27 100644 --- a/third_party/rust/env_logger/LICENSE-MIT +++ b/third_party/rust/env_logger/LICENSE-MIT @@ -1,5 +1,3 @@ -Copyright (c) 2014 The Rust Project Developers - Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the diff --git a/third_party/rust/env_logger/README.md b/third_party/rust/env_logger/README.md index 4e84e8f34262..75add88fe92a 100644 --- a/third_party/rust/env_logger/README.md +++ b/third_party/rust/env_logger/README.md @@ -1,10 +1,8 @@ # env_logger -[![Maintenance](https://img.shields.io/badge/maintenance-actively%20maintained-brightgreen.svg)](https://github.com/env-logger-rs/env_logger) [![crates.io](https://img.shields.io/crates/v/env_logger.svg)](https://crates.io/crates/env_logger) [![Documentation](https://docs.rs/env_logger/badge.svg)](https://docs.rs/env_logger) -[![Documentation](https://img.shields.io/badge/docs-master-blue.svg)](https://env-logger-rs.github.io/env_logger/env_logger/index.html) -========== +[![Documentation](https://img.shields.io/badge/docs-main-blue.svg)](https://env-logger-rs.github.io/env_logger/env_logger/index.html) Implements a logger that can be configured via environment variables. @@ -12,7 +10,7 @@ Implements a logger that can be configured via environment variables. ### In libraries -`env_logger` makes sense when used in executables (binary projects). Libraries should use the [`log`](https://doc.rust-lang.org/log) crate instead. +`env_logger` makes sense when used in executables (binary projects). Libraries should use the [`log`](https://docs.rs/log) crate instead. ### In executables @@ -21,7 +19,7 @@ It must be added along with `log` to the project dependencies: ```toml [dependencies] log = "0.4.0" -env_logger = "0.8.4" +env_logger = "0.9.0" ``` `env_logger` must be initialized as early as possible in the project. After it's initialized, you can use the `log` macros to do actual logging. @@ -77,7 +75,7 @@ There is also a pseudo logging level, `off`, which may be specified to disable all logging for a given module or for the entire application. As with the logging levels, the letter case is not significant. -`env_logger` can be configured in other ways besides an environment variable. See [the examples](https://github.com/env-logger-rs/env_logger/tree/master/examples) for more approaches. +`env_logger` can be configured in other ways besides an environment variable. See [the examples](https://github.com/env-logger-rs/env_logger/tree/main/examples) for more approaches. ### In tests @@ -88,7 +86,7 @@ Tests can use the `env_logger` crate to see log messages generated during that t log = "0.4.0" [dev-dependencies] -env_logger = "0.8.4" +env_logger = "0.9.0" ``` ```rust diff --git a/third_party/rust/env_logger/src/filter/mod.rs b/third_party/rust/env_logger/src/filter/mod.rs index 9ebeab0b523c..a02d6bc1f0c5 100644 --- a/third_party/rust/env_logger/src/filter/mod.rs +++ b/third_party/rust/env_logger/src/filter/mod.rs @@ -151,7 +151,7 @@ impl Filter { } if let Some(filter) = self.filter.as_ref() { - if !filter.is_match(&*record.args().to_string()) { + if !filter.is_match(&record.args().to_string()) { return false; } } diff --git a/third_party/rust/env_logger/src/fmt/humantime/extern_impl.rs b/third_party/rust/env_logger/src/fmt/humantime/extern_impl.rs index 19dec1b65d39..bdf165c4eb24 100644 --- a/third_party/rust/env_logger/src/fmt/humantime/extern_impl.rs +++ b/third_party/rust/env_logger/src/fmt/humantime/extern_impl.rs @@ -99,7 +99,7 @@ impl fmt::Debug for Timestamp { } f.debug_tuple("Timestamp") - .field(&TimestampValue(&self)) + .field(&TimestampValue(self)) .finish() } } diff --git a/third_party/rust/env_logger/src/fmt/mod.rs b/third_party/rust/env_logger/src/fmt/mod.rs index 21e09577a10b..1677887a6636 100644 --- a/third_party/rust/env_logger/src/fmt/mod.rs +++ b/third_party/rust/env_logger/src/fmt/mod.rs @@ -406,7 +406,7 @@ mod tests { String::from_utf8(buf.bytes().to_vec()).expect("failed to read record") } - fn write_target<'a>(target: &'a str, fmt: DefaultFormat) -> String { + fn write_target(target: &str, fmt: DefaultFormat) -> String { write_record( Record::builder() .args(format_args!("log\nmessage")) diff --git a/third_party/rust/env_logger/src/fmt/writer/mod.rs b/third_party/rust/env_logger/src/fmt/writer/mod.rs index 5bb535392730..2b56772e5479 100644 --- a/third_party/rust/env_logger/src/fmt/writer/mod.rs +++ b/third_party/rust/env_logger/src/fmt/writer/mod.rs @@ -193,7 +193,7 @@ impl Builder { let writer = match mem::take(&mut self.target) { WritableTarget::Stderr => BufferWriter::stderr(self.is_test, color_choice), WritableTarget::Stdout => BufferWriter::stdout(self.is_test, color_choice), - WritableTarget::Pipe(pipe) => BufferWriter::pipe(self.is_test, color_choice, pipe), + WritableTarget::Pipe(pipe) => BufferWriter::pipe(color_choice, pipe), }; Writer { diff --git a/third_party/rust/env_logger/src/fmt/writer/termcolor/extern_impl.rs b/third_party/rust/env_logger/src/fmt/writer/termcolor/extern_impl.rs index 11012fb1582c..fbe37a77bf3f 100644 --- a/third_party/rust/env_logger/src/fmt/writer/termcolor/extern_impl.rs +++ b/third_party/rust/env_logger/src/fmt/writer/termcolor/extern_impl.rs @@ -71,19 +71,19 @@ impl Formatter { pub(in crate::fmt::writer) struct BufferWriter { inner: termcolor::BufferWriter, - test_target: Option, + uncolored_target: Option, } pub(in crate::fmt) struct Buffer { inner: termcolor::Buffer, - has_test_target: bool, + has_uncolored_target: bool, } impl BufferWriter { pub(in crate::fmt::writer) fn stderr(is_test: bool, write_style: WriteStyle) -> Self { BufferWriter { inner: termcolor::BufferWriter::stderr(write_style.into_color_choice()), - test_target: if is_test { + uncolored_target: if is_test { Some(WritableTarget::Stderr) } else { None @@ -94,7 +94,7 @@ impl BufferWriter { pub(in crate::fmt::writer) fn stdout(is_test: bool, write_style: WriteStyle) -> Self { BufferWriter { inner: termcolor::BufferWriter::stdout(write_style.into_color_choice()), - test_target: if is_test { + uncolored_target: if is_test { Some(WritableTarget::Stdout) } else { None @@ -103,30 +103,25 @@ impl BufferWriter { } pub(in crate::fmt::writer) fn pipe( - is_test: bool, write_style: WriteStyle, pipe: Box>, ) -> Self { BufferWriter { // The inner Buffer is never printed from, but it is still needed to handle coloring and other formating inner: termcolor::BufferWriter::stderr(write_style.into_color_choice()), - test_target: if is_test { - Some(WritableTarget::Pipe(pipe)) - } else { - None - }, + uncolored_target: Some(WritableTarget::Pipe(pipe)), } } pub(in crate::fmt::writer) fn buffer(&self) -> Buffer { Buffer { inner: self.inner.buffer(), - has_test_target: self.test_target.is_some(), + has_uncolored_target: self.uncolored_target.is_some(), } } pub(in crate::fmt::writer) fn print(&self, buf: &Buffer) -> io::Result<()> { - if let Some(target) = &self.test_target { + if let Some(target) = &self.uncolored_target { // This impl uses the `eprint` and `print` macros // instead of `termcolor`'s buffer. // This is so their output can be captured by `cargo test` @@ -164,7 +159,7 @@ impl Buffer { fn set_color(&mut self, spec: &ColorSpec) -> io::Result<()> { // Ignore styles for test captured logs because they can't be printed - if !self.has_test_target { + if !self.has_uncolored_target { self.inner.set_color(spec) } else { Ok(()) @@ -173,7 +168,7 @@ impl Buffer { fn reset(&mut self) -> io::Result<()> { // Ignore styles for test captured logs because they can't be printed - if !self.has_test_target { + if !self.has_uncolored_target { self.inner.reset() } else { Ok(()) @@ -339,6 +334,33 @@ impl Style { self } + /// Set whether the text is dimmed. + /// + /// If `yes` is true then text will be written in a dimmer color. + /// If `yes` is false then text will be written in the default color. + /// + /// # Examples + /// + /// Create a style with dimmed text: + /// + /// ``` + /// use std::io::Write; + /// + /// let mut builder = env_logger::Builder::new(); + /// + /// builder.format(|buf, record| { + /// let mut style = buf.style(); + /// + /// style.set_dimmed(true); + /// + /// writeln!(buf, "{}", style.value(record.args())) + /// }); + /// ``` + pub fn set_dimmed(&mut self, yes: bool) -> &mut Style { + self.spec.set_dimmed(yes); + self + } + /// Set the background color. /// /// # Examples @@ -453,7 +475,7 @@ impl_styled_value_fmt!( fmt::LowerExp ); -// The `Color` type is copied from https://github.com/BurntSushi/ripgrep/tree/master/termcolor +// The `Color` type is copied from https://github.com/BurntSushi/termcolor /// The set of available colors for the terminal foreground/background. /// diff --git a/third_party/rust/env_logger/src/fmt/writer/termcolor/shim_impl.rs b/third_party/rust/env_logger/src/fmt/writer/termcolor/shim_impl.rs index bfc31d087430..0705770c95fe 100644 --- a/third_party/rust/env_logger/src/fmt/writer/termcolor/shim_impl.rs +++ b/third_party/rust/env_logger/src/fmt/writer/termcolor/shim_impl.rs @@ -24,7 +24,6 @@ impl BufferWriter { } pub(in crate::fmt::writer) fn pipe( - _is_test: bool, _write_style: WriteStyle, pipe: Box>, ) -> Self { diff --git a/third_party/rust/env_logger/src/lib.rs b/third_party/rust/env_logger/src/lib.rs index 8504108587f8..642b731af3f2 100644 --- a/third_party/rust/env_logger/src/lib.rs +++ b/third_party/rust/env_logger/src/lib.rs @@ -1,10 +1,6 @@ -// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// // Licensed under the Apache License, Version 2.0 or the MIT license -// , at your +// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// , at your // option. This file may not be copied, modified, or distributed // except according to those terms. @@ -107,7 +103,7 @@ //! your program is in a file called, for example, `hello.rs`, the path would //! simply be be `hello`. //! -//! Furthermore, the the log can be filtered using prefix-search based on the +//! Furthermore, the log can be filtered using prefix-search based on the //! specified log target. A value of, for example, `RUST_LOG=example`, would //! match all of the messages with targets: //! @@ -676,7 +672,7 @@ impl Builder { /// /// # Examples /// - /// Only include messages for info and above for logs in `path::to::module`: + /// Only include messages for info and above for logs globally: /// /// ``` /// use env_logger::Builder;