Update Rust crate env_logger to 0.11 - autoclosed #583
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
0.4
->0.11
Release Notes
rust-cli/env_logger (env_logger)
v0.11.5
Compare Source
v0.11.4
Compare Source
v0.11.3
Compare Source
Features
unstable-kv
v0.11.2
Compare Source
v0.11.1
Compare Source
Fixes
Target::Pipe
v0.11.0
Compare Source
Migration Guide
env_logger::fmt::Style:
The bespoke styling API, behind
color
, was removed, in favor of accepting anyANSI styled string and adapting it to the target stream's capabilities.
Possible styling libraries include:
env_logger::fmt::style
custom_format.rs
uses
anstyle
viaFormatter::default_level_style
Breaking Change
env_logger::fmt::Formatter::style
env_logger::fmt::Formatter::default_styled_level
env_logger::fmt::Style
env_logger::fmt::Color
env_logger::fmt::StyledValue
env_logger::filter
in favor ofenv_filter
Compatibility
MSRV changed to 1.71
Features
NO_COLOR
andCLICOLOR_FORCE
, see https://bixense.com/clicolors/Fixes
is_test(true)
v0.10.2
Compare Source
Performance
Fixes
color
is disabledv0.10.1
Compare Source
Performance
Documentation
RUST_LOG
documentationv0.10.0
Compare Source
MSRV changed to 1.60 to hide optional dependencies
Fixes
atty
tois-terminal
Breaking Changes
To open room for changing dependencies:
termcolor
feature tocolor
atty
feature toauto-color
v0.9.3
Compare Source
v0.9.2
Compare Source
v0.9.1
Compare Source
v0.9.0
Compare Source
Breaking Changes
Improvements
v0.8.4
: 0.8.4Compare Source
Improvements:
Target::Pipe
)Bug fixes:
env_logger::Builder
s methods, as documentedv0.8.3
: 0.8.3Compare Source
New features:
Builder::format_suffix
) [#192]Improvements:
Bug fixes:
rust-toolchain
whose presence caused issues for a few people)v0.8.2
: 0.8.2Compare Source
Fixed a panic on io errors when writing to stdout / stderr (#184).
v0.8.1
: 0.8.1Compare Source
Update links in the documentation that were pointing to the old repository location.
v0.8.0
: 0.8.0Compare Source
Breaking changes:
Improvements:
Deprecations:
env_logger::from_env
has been deprecated in favor ofenv_logger::Builder::from_env
This release raises the minimum supported Rust version to 1.41.0.
v0.7.1
: 0.7.1Compare Source
Key Changes
Contributions
v0.7.0
: 0.7.0Compare Source
Key Changes
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
v0.6.2
: 0.6.2Compare Source
Key Changes
Contributions
v0.6.1
: 0.6.1Compare Source
Key Changes
cargo test
stdout
Contributions
More Details
Builder::is_test
The
is_test
method can be used in tests to make sure logs are captured bycargo test
the same wayprintln!
is:There are performance implications of using
is_test
though, so it should be avoided outside of unit tests.v0.6.0
: 0.6.0Compare Source
Key Changes
log
optional (but enabled by default)Breaking Changes
log
. That means compilingenv_logger
withdefault-features=false
will result in a different experience than in0.5.x
.Contributions
-Z minimal-versions
on CIMore Details
Disabling dependencies
Using
default-features=false
will disable all dependencies ofenv_logger
besideslog
. 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
: 0.5.13Compare Source
Key Changes
Contributions
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 aFormatter
. The below example will format just the record message using the style of its level:v0.5.12
: 0.5.12Compare Source
Key Changes
Contributions
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 totrue
, timestamps will include a 6-digit nanosecond component like2018-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 existingtimestamp
one.v0.5.11
: 0.5.11Compare Source
Key Changes
termcolor
to1.0
rustc
to1.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
v0.5.10
: 0.5.10Compare Source
Key Changes
regex
to1.0
.Contributions
v0.5.9
: 0.5.9Compare Source
Key Changes
Contributions
More Details
filter_module
andfilter_level
Adds two new methods to
Builder
andfilter::Builder
that are specific cases of the existingfilter
method:filter_module
adds a directive for the given module. It's the same asfilter(Some(module), level)
filter_level
adds a directive for all modules. It's the same asfilter(None, level)
v0.5.8
: 0.5.8Compare Source
Key Changes
Contributions
More Details
Env::filter_or
andEnv::write_style_or
Default values for environment variables can be specified on the
Env
type using thefilter_or
andwrite_style_or
methods. The default value is a string in the same format as the environment variable:In usage:
DEFAULT_FILTER_ENV
andDEFAULT_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
: 0.5.7Compare Source
Contributions
v0.5.6
: 0.5.6Compare Source
Key Changes
termcolor::Color
API so it's no longer a public dependencyContributions
More Details
This patch fixes an issue that slipped through
0.5.0
where thetermcolor::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 inenv_logger
. The potential breakage is if anyone was relying on the fact thatenv_logger::Color
andtermcolor::Color
were equivalent types. This was only obvious from the source, and a survey of public code usingenv_logger
and call for comment hasn't revealed any code relying on this.v0.5.5
: 0.5.5Compare Source
Key Changes
Contributions
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:Calling
default_format_*
will store whether or not we want to include those parts of the log, without affecting a custom format. That means:Is the same as:
Setting a custom format won't clobber any values passed to
default_format_*
methods. That means:Is the same as:
Builder::from_default_env
A new
from_default_env
method that's a convenient way of callingfrom_env(env_logger::Env::default())
.v0.5.4
: 0.5.4Compare Source
Key Changes
humantime
instead ofchrono
for formatting timestampsChanges 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
for formatting timestamps. This replaces the dependency onchrono
Contributions
v0.5.3
: 0.5.3Compare Source
Key Changes
set_intense(true)
to produce a lighter color, andset_intense(false)
to produce the default color.Contributions
fmt::Style::set_intense
v0.5.2
: 0.5.2Compare Source
Key Changes
stdout
/stderr
is a tty and write styles accordingly. This fixes an issue with color control characters showing up logs piped to filesNew Dependencies
atty
for interrogatingstdout
/stderr
Contributions
v0.5.1
: 0.5.1Compare Source
Key Changes
Contributions
v0.5.0
: 0.5.0Compare Source
NOTE: These release notes are collected from the
0.5.0-rc.1
and0.5.0-rc.2
release notes.Key Changes
Breaking Changes
LogTarget
has been renamed toTarget
LogBuilder
has been renamed toBuilder
Builder::format
method now accepts aF: Fn(&mut Formatter, &Record) -> Result<()> + Sync + Send
. This is the new formatting API that writes into aFormatter
instead of producing an ownedString
Builder::init
will panic if the logger can't be initialised. A newBuilder::try_init
method has been added with the same semantics as the oldBuilder::init
methodNew Dependencies
chrono
for the timestamptermcolor
for record buffering and colorsContributions
log
/ deny debug impls, missing docs, and warnings.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:$ export RUST_LOG_STYLE=never $ ./my-app
Valid values are:
auto
(or missing/invalid) will decide whether or not the terminal supports colorsalways
will always use colorsnever
will never use colorsIn order to support multiple environment variables, I've refactored our
from_env
functions to accept a genericT: Into<Env>
, whereEnv
is a container for the environment variables we care about. These methods can now be called in a few ways: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 anEnv
type with builder methods for naming environment variables:With a few
From
conversions, the above is also equivalent to: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:
This saves you from having to split the writes into multiple calls and juggle
Result
types.Writing timestamps
Call the
timestamp
method on aFormatter
to get an opaque timestamp that can be logged. It'll be written in an RFC3339 format: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.