balena-os / wifi-connect

Easy WiFi setup for Linux devices from your mobile phone or laptop
Apache License 2.0
1.3k stars 365 forks source link

Update Rust crate env_logger to 0.11 - autoclosed #583

Closed balena-renovate[bot] closed 4 months ago

balena-renovate[bot] commented 4 months ago

This PR contains the following updates:

Package Type Update Change
env_logger dependencies minor 0.4 -> 0.11

Release Notes

rust-cli/env_logger (env_logger) ### [`v0.11.5`](https://togithub.com/rust-cli/env_logger/blob/HEAD/CHANGELOG.md#0115---2024-07-25) [Compare Source](https://togithub.com/rust-cli/env_logger/compare/v0.11.4...v0.11.5) ### [`v0.11.4`](https://togithub.com/rust-cli/env_logger/blob/HEAD/CHANGELOG.md#0114---2024-07-23) [Compare Source](https://togithub.com/rust-cli/env_logger/compare/v0.11.3...v0.11.4) ### [`v0.11.3`](https://togithub.com/rust-cli/env_logger/blob/HEAD/CHANGELOG.md#0113---2024-03-05) [Compare Source](https://togithub.com/rust-cli/env_logger/compare/v0.11.2...v0.11.3) ##### Features - Experimental support for key-value logging behind `unstable-kv` ### [`v0.11.2`](https://togithub.com/rust-cli/env_logger/blob/HEAD/CHANGELOG.md#0112---2024-02-13) [Compare Source](https://togithub.com/rust-cli/env_logger/compare/v0.11.1...v0.11.2) ### [`v0.11.1`](https://togithub.com/rust-cli/env_logger/blob/HEAD/CHANGELOG.md#0111---2024-01-27) [Compare Source](https://togithub.com/rust-cli/env_logger/compare/v0.11.0...v0.11.1) ##### Fixes - Allow styling with `Target::Pipe` ### [`v0.11.0`](https://togithub.com/rust-cli/env_logger/blob/HEAD/CHANGELOG.md#0110---2024-01-19) [Compare Source](https://togithub.com/rust-cli/env_logger/compare/v0.10.2...v0.11.0) ##### Migration Guide **env_logger::fmt::Style:** The bespoke styling API, behind `color`, was removed, in favor of accepting any ANSI styled string and adapting it to the target stream's capabilities. Possible styling libraries include: - [anstyle](https://docs.rs/anstyle) is a minimal, runtime string styling API and is re-exported as `env_logger::fmt::style` - [owo-colors](https://docs.rs/owo-colors) is a feature rich runtime string styling API - [color-print](https://docs.rs/color-print) for feature-rich compile-time styling API [custom_format.rs](https://docs.rs/env_logger/latest/src/custom_format/custom_format.rs.html) uses `anstyle` via [`Formatter::default_level_style`](https://docs.rs/env_logger/latest/env_logger/fmt/struct.Formatter.html#method.default_level_style) ##### Breaking Change - Removed bespoke styling API - `env_logger::fmt::Formatter::style` - `env_logger::fmt::Formatter::default_styled_level` - `env_logger::fmt::Style` - `env_logger::fmt::Color` - `env_logger::fmt::StyledValue` - Removed `env_logger::filter` in favor of `env_filter` ##### Compatibility MSRV changed to 1.71 ##### Features - Automatically adapt ANSI escape codes in logged messages to the current terminal's capabilities - Add support for `NO_COLOR` and `CLICOLOR_FORCE`, see https://bixense.com/clicolors/ ##### Fixes - Print colors when `is_test(true)` ### [`v0.10.2`](https://togithub.com/rust-cli/env_logger/blob/HEAD/CHANGELOG.md#0102---2024-01-18) [Compare Source](https://togithub.com/rust-cli/env_logger/compare/v0.10.1...v0.10.2) ##### Performance - Avoid extra UTF-8 validation performed in some cases ##### Fixes - Ensure custom pipes/stdout get flushed - Don't panic on broken pipes when `color` is disabled ### [`v0.10.1`](https://togithub.com/rust-cli/env_logger/blob/HEAD/CHANGELOG.md#0101---2023-11-10) [Compare Source](https://togithub.com/rust-cli/env_logger/compare/v0.10.0...v0.10.1) ##### Performance - Avoid hashing directives and accessing RNG on startup ##### Documentation - Tweak `RUST_LOG` documentation ### [`v0.10.0`](https://togithub.com/rust-cli/env_logger/blob/HEAD/CHANGELOG.md#0100---2022-11-24) [Compare Source](https://togithub.com/rust-cli/env_logger/compare/v0.9.3...v0.10.0) MSRV changed to 1.60 to hide optional dependencies ##### Fixes - Resolved soundness issue by switching from `atty` to `is-terminal` ##### Breaking Changes To open room for changing dependencies: - Renamed `termcolor` feature to `color` - Renamed `atty` feature to `auto-color` ### [`v0.9.3`](https://togithub.com/rust-cli/env_logger/blob/HEAD/CHANGELOG.md#093---2022-11-07) [Compare Source](https://togithub.com/rust-cli/env_logger/compare/v0.9.2...v0.9.3) - Fix a regression from v0.9.2 where env_logger would fail to compile with the termcolor feature turned off. ### [`v0.9.2`](https://togithub.com/rust-cli/env_logger/blob/HEAD/CHANGELOG.md#092---2022-11-07) [Compare Source](https://togithub.com/rust-cli/env_logger/compare/v0.9.1...v0.9.2) - Fix and un-deprecate Target::Pipe, which was basically not working at all before and deprecated in 0.9.1. ### [`v0.9.1`](https://togithub.com/rust-cli/env_logger/compare/v0.9.0...v0.9.1) [Compare Source](https://togithub.com/rust-cli/env_logger/compare/v0.9.0...v0.9.1) ### [`v0.9.0`](https://togithub.com/rust-cli/env_logger/blob/HEAD/CHANGELOG.md#090----2022-07-14) [Compare Source](https://togithub.com/rust-cli/env_logger/compare/v0.8.4...v0.9.0) ##### Breaking Changes - Default message format now prints the target instead of the module ##### Improvements - Added a method to print the module instead of the target [Unreleased]: https://togithub.com/rust-cli/env_logger/compare/v0.11.5...HEAD [0.11.5]: https://togithub.com/rust-cli/env_logger/compare/v0.11.4...v0.11.5 [0.11.4]: https://togithub.com/rust-cli/env_logger/compare/v0.11.3...v0.11.4 [0.11.3]: https://togithub.com/rust-cli/env_logger/compare/v0.11.2...v0.11.3 [0.11.2]: https://togithub.com/rust-cli/env_logger/compare/v0.11.1...v0.11.2 [0.11.1]: https://togithub.com/rust-cli/env_logger/compare/v0.11.0...v0.11.1 [0.11.0]: https://togithub.com/rust-cli/env_logger/compare/v0.10.2...v0.11.0 [0.10.2]: https://togithub.com/rust-cli/env_logger/compare/v0.10.1...v0.10.2 [0.10.1]: https://togithub.com/rust-cli/env_logger/compare/v0.10.0...v0.10.1 [0.10.0]: https://togithub.com/rust-cli/env_logger/compare/v0.9.3...v0.10.0 [0.9.3]: https://togithub.com/rust-cli/env_logger/compare/v0.9.2...v0.9.3 [0.9.2]: https://togithub.com/rust-cli/env_logger/compare/v0.9.0...v0.9.2 [0.9.0]: https://togithub.com/rust-cli/env_logger/compare/v0.8.4...v0.9.0 ### [`v0.8.4`](https://togithub.com/rust-cli/env_logger/releases/tag/v0.8.4): 0.8.4 [Compare Source](https://togithub.com/rust-cli/env_logger/compare/v0.8.3...v0.8.4) Improvements: - Allow writing logs to a custom output target (via `Target::Pipe`) Bug fixes: - Actually allow overriding filter levels using `env_logger::Builder`s methods, as documented ### [`v0.8.3`](https://togithub.com/rust-cli/env_logger/releases/tag/v0.8.3): 0.8.3 [Compare Source](https://togithub.com/rust-cli/env_logger/compare/v0.8.2...v0.8.3) New features: - Suffix customization for the default formatter (`Builder::format_suffix`) \[[#​192](https://togithub.com/rust-cli/env_logger/issues/192)] Improvements: - Improve documentation about log level names \[[#​189](https://togithub.com/rust-cli/env_logger/issues/189)] Bug fixes: - Ignore whitespace-only filter specifications \[[#​188](https://togithub.com/rust-cli/env_logger/issues/188)] - Remove unneded files from crates.io tarball (including `rust-toolchain` whose presence caused issues for a few people) ### [`v0.8.2`](https://togithub.com/rust-cli/env_logger/releases/tag/v0.8.2): 0.8.2 [Compare Source](https://togithub.com/rust-cli/env_logger/compare/v0.8.1...v0.8.2) Fixed a panic on io errors when writing to stdout / stderr ([#​184](https://togithub.com/rust-cli/env_logger/issues/184)). ### [`v0.8.1`](https://togithub.com/rust-cli/env_logger/releases/tag/v0.8.1): 0.8.1 [Compare Source](https://togithub.com/rust-cli/env_logger/compare/v0.8.0...v0.8.1) Update links in the documentation that were pointing to the old repository location. ### [`v0.8.0`](https://togithub.com/rust-cli/env_logger/releases/tag/v0.8.0): 0.8.0 [Compare Source](https://togithub.com/rust-cli/env_logger/compare/v0.7.1...v0.8.0) Breaking changes: - Update public dependency humantime to 2.0 Improvements: - Update default colors for debug (white => blue) and trace (black => cyan) Deprecations: - `env_logger::from_env` has been deprecated in favor of `env_logger::Builder::from_env` This release raises the minimum supported Rust version to 1.41.0. ### [`v0.7.1`](https://togithub.com/rust-cli/env_logger/releases/tag/v0.7.1): 0.7.1 [Compare Source](https://togithub.com/rust-cli/env_logger/compare/v0.7.0...v0.7.1) ### Key Changes - More thread-local durability ### Contributions - [@​divergentdave](https://togithub.com/divergentdave) [Thread local fallback](https://togithub.com/sebasmagri/env_logger/pull/146) ### [`v0.7.0`](https://togithub.com/rust-cli/env_logger/releases/tag/v0.7.0): 0.7.0 [Compare Source](https://togithub.com/rust-cli/env_logger/compare/v0.6.2...v0.7.0) ### Key Changes - Indent multiline messages by default - Support more timestamp precision - Update to the 2018 edition ### Changes to minimum Rust The minimum version of Rust required has been set at `1.31.0`. We may change this in patch versions, but will always flag it in the release notes here. You can always check the `.travis.yml` file to see the current minimum supported version. ### Contributions - [@​95ulisse](https://togithub.com/95ulisse) [Indentation for multiline log messages](https://togithub.com/sebasmagri/env_logger/pull/134) - [@​oherrala](https://togithub.com/oherrala) [Add more timestamp precisions](https://togithub.com/sebasmagri/env_logger/pull/140) - [Update to 2018 edition](https://togithub.com/sebasmagri/env_logger/pull/142) ### [`v0.6.2`](https://togithub.com/rust-cli/env_logger/releases/tag/v0.6.2): 0.6.2 [Compare Source](https://togithub.com/rust-cli/env_logger/compare/v0.6.1...v0.6.2) ### Key Changes - Additional examples and docs ### Contributions - [@​shepmaster](https://togithub.com/shepmaster) [Redirect people to GitHub Releases for changesn](https://togithub.com/sebasmagri/env_logger/pull/129) - [Fix up test init example](https://togithub.com/sebasmagri/env_logger/pull/132) - [Add some more examples for configuring env_logger](https://togithub.com/sebasmagri/env_logger/pull/133) - [Fix up the build on nightly compilers](https://togithub.com/sebasmagri/env_logger/pull/135) ### [`v0.6.1`](https://togithub.com/rust-cli/env_logger/releases/tag/v0.6.1): 0.6.1 [Compare Source](https://togithub.com/rust-cli/env_logger/compare/v0.6.0...v0.6.1) ### Key Changes - Support better capturing for `cargo test` - Don't print internal logs to `stdout` ### Contributions - [@​nlopes](https://togithub.com/nlopes) [Fix path for rust-lang favicon](https://togithub.com/sebasmagri/env_logger/pull/120) - [@​emilio](https://togithub.com/emilio) [Don't print to stdout the warnings due to an invalid spec](https://togithub.com/sebasmagri/env_logger/pull/126) - [Support capturing for cargo test](https://togithub.com/sebasmagri/env_logger/pull/127) ### More Details #### `Builder::is_test` The `is_test` method can be used in tests to make sure logs are captured by `cargo test` the same way `println!` is: ```rust fn init() { let _ = env_logger::builder().is_test(true).try_init(); } #[test] fn it_adds_one() { init(); info!("can log from the test too"); assert_eq!(3, add_one(2)); } ``` There are performance implications of using `is_test` though, so it should be avoided outside of unit tests. ### [`v0.6.0`](https://togithub.com/rust-cli/env_logger/releases/tag/v0.6.0): 0.6.0 [Compare Source](https://togithub.com/rust-cli/env_logger/compare/v0.5.13...v0.6.0) ### Key Changes - Set a policy for changes to the default format - Make all dependencies besides `log` optional (but enabled by default) ### Breaking Changes - The default format is not considered stable across patch versions. The best way to get a stable format for later ripgrepping is to define a custom one. - All dependencies have been made optional except for `log`. That means compiling `env_logger` with `default-features=false` will result in a different experience than in `0.5.x`. ### Contributions - [@​hcpl](https://togithub.com/hcpl) [Test with `-Z minimal-versions` on CI](https://togithub.com/sebasmagri/env_logger/pull/114) - [@​afck](https://togithub.com/afck) [Add missing RFC3339 URL to fix rustdoc](https://togithub.com/sebasmagri/env_logger/pull/105) - [Make all dependencies optional](https://togithub.com/sebasmagri/env_logger/pull/100) - [Rework the default format](https://togithub.com/sebasmagri/env_logger/pull/82) - [Don't clobber a previously set level filter](https://togithub.com/sebasmagri/env_logger/pull/117) ### More Details #### Disabling dependencies Using `default-features=false` will disable all dependencies of `env_logger` besides `log`. This will reduce compile times and alter the default format by disabling colours and timestamps. Disabling default dependencies is the recommended way to use `env_logger` for libraries that only need it for logging in tests. ### [`v0.5.13`](https://togithub.com/rust-cli/env_logger/releases/tag/v0.5.13): 0.5.13 [Compare Source](https://togithub.com/rust-cli/env_logger/compare/v0.5.12...v0.5.13) ### Key Changes - Add a public function for getting the default level style ### Contributions - [@​felixrabe](https://togithub.com/felixrabe) [Typo](https://togithub.com/sebasmagri/env_logger/pull/98) - [@​upsuper](https://togithub.com/upsuper) [Move default level style to a public function](https://togithub.com/sebasmagri/env_logger/pull/99) - [@​Eh2406](https://togithub.com/Eh2406) [update some debs for minimal-versions](https://togithub.com/sebasmagri/env_logger/pull/101) ### More Details #### `Formatter::default_level_style` The style used in the default format for printing level names can be fetched using the new `default_level_style` method on a `Formatter`. The below example will format just the record message using the style of its level: ```rust builder.format(|buf, record| { let level_style = buf.default_level_style(level); write!(buf, "{} ", level_style.value(record.args())) }); ``` ### [`v0.5.12`](https://togithub.com/rust-cli/env_logger/releases/tag/v0.5.12): 0.5.12 [Compare Source](https://togithub.com/rust-cli/env_logger/compare/v0.5.11...v0.5.12) ### Key Changes - Add support for high-precision timestamps ### Contributions - [@​ivan-ochc](https://togithub.com/ivan-ochc) [add precise timestamp with nanos](https://togithub.com/sebasmagri/env_logger/pull/94) - [@​KodrAus](https://togithub.com/KodrAus) [add some docs on defaulting env vars](https://togithub.com/sebasmagri/env_logger/pull/96) ### More Details #### `Builder::default_format_timestamp_nanos` The `Builder::default_format_timestamp_nanos` method can be used to toggle the precision of timestamps in the default format. When set to `true`, timestamps will include a 6-digit nanosecond component like `2018-02-14T00:28:07.000000000Z`. #### `Formatter::precise_timestamp` Custom formats can get a precise timestamp instead of the default by calling the `precise_timestamp` method instead of the existing `timestamp` one. ### [`v0.5.11`](https://togithub.com/rust-cli/env_logger/releases/tag/v0.5.11): 0.5.11 [Compare Source](https://togithub.com/rust-cli/env_logger/compare/v0.5.10...v0.5.11) ### Key Changes - Update `termcolor` to `1.0` - Bump minimum `rustc` to `1.20.0` ### Changes to minimum Rust The minimum version of Rust required has been set at `1.20.0`. We may change this in patch versions, but will always flag it in the release notes here. You can always check the `.travis.yml` file to see the current minimum supported version. ### Contributions - [@​ignatenkobrain](https://togithub.com/ignatenkobrain) [deps: update termcolor to 1](https://togithub.com/sebasmagri/env_logger/pull/90) ### [`v0.5.10`](https://togithub.com/rust-cli/env_logger/releases/tag/v0.5.10): 0.5.10 [Compare Source](https://togithub.com/rust-cli/env_logger/compare/v0.5.9...v0.5.10) ### Key Changes - Update `regex` to `1.0`. ### Contributions - [@​Eijebong](https://togithub.com/Eijebong) [Update regex to 1.0 and bump version](https://togithub.com/sebasmagri/env_logger/pull/86) ### [`v0.5.9`](https://togithub.com/rust-cli/env_logger/releases/tag/v0.5.9): 0.5.9 [Compare Source](https://togithub.com/rust-cli/env_logger/compare/v0.5.8...v0.5.9) ### Key Changes - Add some convenient methods for adding filter directives ### Contributions - [@​KodrAus](https://togithub.com/KodrAus) [Add methods for filtering by module and level](https://togithub.com/sebasmagri/env_logger/pull/84) ### More Details #### `filter_module` and `filter_level` Adds two new methods to `Builder` and `filter::Builder` that are specific cases of the existing `filter` method: - `filter_module` adds a directive for the given module. It's the same as `filter(Some(module), level)` - `filter_level` adds a directive for all modules. It's the same as `filter(None, level)` ### [`v0.5.8`](https://togithub.com/rust-cli/env_logger/releases/tag/v0.5.8): 0.5.8 [Compare Source](https://togithub.com/rust-cli/env_logger/compare/v0.5.7...v0.5.8) ### Key Changes - Support setting default values for environment variables before initialising a logger ### Contributions - [@​KodrAus](https://togithub.com/KodrAus) [Add support for default env values](https://togithub.com/sebasmagri/env_logger/pull/81) ### More Details #### `Env::filter_or` and `Env::write_style_or` Default values for environment variables can be specified on the `Env` type using the `filter_or` and `write_style_or` methods. The default value is a string in the same format as the environment variable: ```rust impl Env { fn filter_or(self, filter_env: E, default: V) -> Self where E: Into>, V: Into>; fn write_style_or(self, write_style_env: E, default: V) -> Self where E: Into>, V: Into>; } ``` In usage: ```rust let env = Env::default() .filter_or("MY_LOG_LEVEL", "trace") .write_style_or("MY_LOG_STYLE", "always"); env_logger::init_from_env(env); ``` #### `DEFAULT_FILTER_ENV` and `DEFAULT_WRITE_STYLE_ENV` Two new constants are publicly exported that correspond to the default environment variable names used for the filters and style preferences. ### [`v0.5.7`](https://togithub.com/rust-cli/env_logger/releases/tag/v0.5.7): 0.5.7 [Compare Source](https://togithub.com/rust-cli/env_logger/compare/v0.5.6...v0.5.7) ### Contributions - [@​KodrAus](https://togithub.com/KodrAus) [Add from_env methods to Logger directly](https://togithub.com/sebasmagri/env_logger/pull/78) - [@​lnicola](https://togithub.com/lnicola) [Add note about dashes](https://togithub.com/sebasmagri/env_logger/pull/77) ### [`v0.5.6`](https://togithub.com/rust-cli/env_logger/releases/tag/v0.5.6): 0.5.6 [Compare Source](https://togithub.com/rust-cli/env_logger/compare/v0.5.5...v0.5.6) ### Key Changes - Wrap the `termcolor::Color` API so it's no longer a public dependency ### Contributions - [@​KodrAus](https://togithub.com/KodrAus) [Wrap termcolor's color api](https://togithub.com/sebasmagri/env_logger/pull/75) ### More Details This patch fixes an issue that slipped through `0.5.0` where the `termcolor::Color` type was re-exported instead of redefined. **This is a potentially breaking change** Instead of re-exporting `termcolor::Color`, we now redefine the same API in `env_logger`. The potential breakage is if anyone was relying on the fact that `env_logger::Color` and `termcolor::Color` were equivalent types. This was only obvious from the source, and a survey of public code using `env_logger` and call for comment hasn't revealed any code relying on this. ### [`v0.5.5`](https://togithub.com/rust-cli/env_logger/releases/tag/v0.5.5): 0.5.5 [Compare Source](https://togithub.com/rust-cli/env_logger/compare/v0.5.4...v0.5.5) ### Key Changes - Allow toggling parts of the default format without having to write one from scratch ### Contributions - [@​KodrAus](https://togithub.com/KodrAus) [Allow toggling parts of the default format](https://togithub.com/sebasmagri/env_logger/pull/66) ### More Details #### `Builder::default_format_*` The default format can be easily tweaked by conditionally enabling/disabling parts of it in the main `Builder`. The API looks like: ```rust impl Builder { fn default_format(&mut self) -> &mut Self; fn default_format_timestamp(&mut self, write: bool) -> &mut Self; fn default_format_module_path(&mut self, write: bool) -> &mut Self; fn default_format_level(&mut self, write: bool) -> &mut Self; } ``` Calling `default_format_*` will store whether or not we want to include those parts of the log, without affecting a custom format. That means: ```rust Builder::new() .format(|buf, record| { ... }) .default_format_timestamp(false) .init(); ``` Is the same as: ```rust Builder::new() .format(|buf, record| { ... }) .init(); ``` Setting a custom format won't clobber any values passed to `default_format_*` methods. That means: ```rust Builder::new() .default_format_timestamp(false) .format(|buf, record| { ... }) .default_format() .init(); ``` Is the same as: ```rust Builder::new() .default_format_timestamp(false) .init(); ``` #### `Builder::from_default_env` A new `from_default_env` method that's a convenient way of calling `from_env(env_logger::Env::default())`. ### [`v0.5.4`](https://togithub.com/rust-cli/env_logger/releases/tag/v0.5.4): 0.5.4 [Compare Source](https://togithub.com/rust-cli/env_logger/compare/v0.5.3...v0.5.4) ### Key Changes - Better panic message when attempting to initialise the global logger multiple times - Use `humantime` instead of `chrono` for formatting timestamps ### Changes to minimum Rust The minimum version of Rust required has been set at `1.18.0`. We may change this in patch versions, but will always flag it in the release notes here. You can always check the `.travis.yml` file to see the current minimum supported version. ### New Dependencies - [`humantime`](https://crates.io/crates/humantime) for formatting timestamps. This replaces the dependency on `chrono` ### Contributions - [@​BurntSushi](https://togithub.com/BurntSushi) [ci: add minimum Rust version](https://togithub.com/sebasmagri/env_logger/pull/64) - [@​stepancheg](https://togithub.com/stepancheg) [Better error message when init called twice](https://togithub.com/sebasmagri/env_logger/pull/68) - [@​tailhook](https://togithub.com/tailhook) [Use humantime instead of chrono ](https://togithub.com/sebasmagri/env_logger/pull/67) ### [`v0.5.3`](https://togithub.com/rust-cli/env_logger/releases/tag/v0.5.3): 0.5.3 [Compare Source](https://togithub.com/rust-cli/env_logger/compare/v0.5.2...v0.5.3) ### Key Changes - Support *more intense* variants of color using intensity. Call `set_intense(true)` to produce a lighter color, and `set_intense(false)` to produce the default color. ### Contributions - [@​quadrupleslap](https://togithub.com/quadrupleslap) [Added `fmt::Style::set_intense`](https://togithub.com/sebasmagri/env_logger/pull/62) ### [`v0.5.2`](https://togithub.com/rust-cli/env_logger/releases/tag/v0.5.2): 0.5.2 [Compare Source](https://togithub.com/rust-cli/env_logger/compare/v0.5.1...v0.5.2) ### Key Changes - Detect whether `stdout`/`stderr` is a tty and write styles accordingly. This fixes an issue with color control characters showing up logs piped to files ### New Dependencies - [`atty`](https://crates.io/crates/atty) for interrogating `stdout`/`stderr` ### Contributions - [@​quadrupleslap](https://togithub.com/quadrupleslap) [Use atty to check for color support](https://togithub.com/sebasmagri/env_logger/pull/60) ### [`v0.5.1`](https://togithub.com/rust-cli/env_logger/releases/tag/v0.5.1): 0.5.1 [Compare Source](https://togithub.com/rust-cli/env_logger/compare/v0.5.0...v0.5.1) ### Key Changes - Fixed a panic in some rare logging cases and updated some incorrect sample code in the readme ### Contributions - [@​alexheretic](https://togithub.com/alexheretic) [update readme 'in tests' init usage](https://togithub.com/sebasmagri/env_logger/pull/55) - [@​alexcrichton](https://togithub.com/alexcrichton) [Avoid panicking for logging-while-logging](https://togithub.com/sebasmagri/env_logger/pull/57) ### [`v0.5.0`](https://togithub.com/rust-cli/env_logger/releases/tag/v0.5.0): 0.5.0 [Compare Source](https://togithub.com/rust-cli/env_logger/compare/v0.4.3...v0.5.0) **NOTE:** These release notes are collected from the `0.5.0-rc.1` and `0.5.0-rc.2` release notes. ### Key Changes - Support for using custom environment variables to parse the log level filter and color output - Added colors with configuration through an environment variable and an RFC3339-formatted timestamp to the default format - Buffer log output so logs over multiple lines won't end up interleaved in multi-threaded applications - Move the filter parsing into its own module so it's easier to consume in custom loggers - Documentation! ### Breaking Changes - `LogTarget` has been renamed to `Target` - `LogBuilder` has been renamed to `Builder` - The `Builder::format` method now accepts a `F: Fn(&mut Formatter, &Record) -> Result<()> + Sync + Send`. This is the new formatting API that writes into a `Formatter` instead of producing an owned `String` - `Builder::init` will panic if the logger can't be initialised. A new `Builder::try_init` method has been added with the same semantics as the old `Builder::init` method ### New Dependencies - [`chrono`](https://crates.io/crates/chrono) for the timestamp - [`termcolor`](https://crates.io/crates/termcolor) for record buffering and colors ### Contributions - [@​matthiasbeyer](https://togithub.com/matthiasbeyer) [Dependencies: log: 0.4.0-rc.1 -> 0.4.0](https://togithub.com/sebasmagri/env_logger/pull/49) - [@​KodrAus](https://togithub.com/KodrAus) [Public color API](https://togithub.com/sebasmagri/env_logger/pull/46) - [@​rukai](https://togithub.com/rukai) [Fix spelling error](https://togithub.com/sebasmagri/env_logger/pull/44) - [@​KodrAus](https://togithub.com/KodrAus) [Make the timestamp format more compact](https://togithub.com/sebasmagri/env_logger/pull/36) - [@​mjkillough](https://togithub.com/mjkillough) [Allow custom timestamp formats.](https://togithub.com/sebasmagri/env_logger/pull/35) - [@​KodrAus](https://togithub.com/KodrAus) [Add rfc3339 timestamps to default format](https://togithub.com/sebasmagri/env_logger/pull/33) - [@​KodrAus](https://togithub.com/KodrAus) [Support colors and buffer writes](https://togithub.com/sebasmagri/env_logger/pull/32) - [@​KodrAus](https://togithub.com/KodrAus) [Make filtering public](https://togithub.com/sebasmagri/env_logger/pull/29) - [@​FuGangqiang](https://togithub.com/FuGangqiang) [fix doc and reformat code style](https://togithub.com/sebasmagri/env_logger/pull/28) - [@​KodrAus](https://togithub.com/KodrAus) [Add examples for custom format and logger impls](https://togithub.com/sebasmagri/env_logger/pull/27) - [@​sfackler](https://togithub.com/sfackler) [Fix std feature name](https://togithub.com/sebasmagri/env_logger/pull/26) - [@​jimmycuadra](https://togithub.com/jimmycuadra) [Adds a new constructor and init functions for custom env vars.](https://togithub.com/sebasmagri/env_logger/pull/25) - [@​jimmycuadra](https://togithub.com/jimmycuadra) [Update to the latest commit of `log` / deny debug impls, missing docs, and warnings.](https://togithub.com/sebasmagri/env_logger/pull/24) - [@​jethrogb](https://togithub.com/jethrogb) [Enable use of Logger as a filter](https://togithub.com/sebasmagri/env_logger/pull/4) Thanks to everybody who helped make this release of `env_logger` happen! ### More Details #### Disabling colors Adds a new builder property for whether or not to include colors. By default this is controlled by the `RUST_LOG_STYLE` environment variable, but it can be overridden. Setting this environment variable to `never` will disable colors and other styles: ```shell $ export RUST_LOG_STYLE=never $ ./my-app ``` Valid values are: - `auto` (or missing/invalid) will decide whether or not the terminal supports colors - `always` will always use colors - `never` will never use colors In order to support multiple environment variables, I've refactored our `from_env` functions to accept a generic `T: Into`, where `Env` is a container for the environment variables we care about. These methods can now be called in a few ways: ```rust // reads filters from `MY_LOG` and styles from `RUST_LOG_STYLE` env_logger::init_from_env("MY_LOG"); // reads filters from `MY_LOG` and styles from `MY_LOG_STYLE` env_logger::init_from_env(Env::default().filter("MY_LOG").write_style("MY_LOG_STYLE")); ``` This lets us add new environment variables in the future without potentially breaking people. But it does mean if you're overriding all environment variables that new ones could slip in without you noticing. #### Using alternative environment variables Since we use two environment variables to configure the logger we need an ergonomic way to pass different combinations of those variables to `from_env` methods. This PR adds an `Env` type with builder methods for naming environment variables: ```rust env_logger::init_from_env(Env::new().filter("MY_LOG")); ``` With a few `From` conversions, the above is also equivalent to: ```rust env_logger::init_from_env("MY_LOG"); ``` Whether or not we want to keep these conversions is up for discussion. #### Writing colors The color API has been refactored and made public so you can use them in your own formats: ```rust let mut style = buf.style(); style.set_color(Color::Red).set_bold(true).set_bg(Color::White); writeln!(buf, "{}", style.value(42)) ``` This saves you from having to split the writes into multiple calls and juggle `Result` types. #### Writing timestamps Call the `timestamp` method on a `Formatter` to get an opaque timestamp that can be logged. It'll be written in an RFC3339 format: ```rust let ts = buf.timestamp(); writeline!(buf, "log at: {}", ts) ```

Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.



This PR has been generated by Renovate Bot.