Releases: rust-cli/env_logger
0.8.1
0.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_envhas been deprecated in favor ofenv_logger::Builder::from_env
This release raises the minimum supported Rust version to 1.41.0.
0.7.1
0.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
0.6.2
Key Changes
- Additional examples and docs
Contributions
0.6.1
Key Changes
- Support better capturing for
cargo test - Don't print internal logs to
stdout
Contributions
- @nlopes Fix path for rust-lang favicon
- @emilio Don't print to stdout the warnings due to an invalid spec
- Support capturing for cargo test
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:
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.
0.6.0
Key Changes
- Set a policy for changes to the default format
- Make all dependencies besides
logoptional (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 compilingenv_loggerwithdefault-features=falsewill result in a different experience than in0.5.x.
Contributions
- @hcpl Test with
-Z minimal-versionson CI - @afck Add missing RFC3339 URL to fix rustdoc
- Make all dependencies optional
- Rework the default format
- Don't clobber a previously set level filter
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.
0.5.13
Key Changes
- Add a public function for getting the default level style
Contributions
- @felixrabe Typo
- @upsuper Move default level style to a public function
- @Eh2406 update some debs for minimal-versions
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:
builder.format(|buf, record| {
let level_style = buf.default_level_style(level);
write!(buf, "{} ", level_style.value(record.args()))
});0.5.12
Key Changes
- Add support for high-precision timestamps
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 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.
0.5.11
Key Changes
- Update
termcolorto1.0 - Bump minimum
rustcto1.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 deps: update termcolor to 1