Skip to content

Releases: rust-cli/env_logger

0.8.1

17 Oct 17:25
26e821b

Choose a tag to compare

Update links in the documentation that were pointing to the old repository location.

0.8.0

16 Oct 18:47
v0.8.0
9ffe00d

Choose a tag to compare

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.

0.7.1

17 Oct 05:09
68a1700

Choose a tag to compare

Key Changes

  • More thread-local durability

Contributions

0.7.0

24 Sep 02:04
424f031

Choose a tag to compare

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

01 Jul 00:08
b598a2c

Choose a tag to compare

0.6.1

07 Mar 03:55
2ae080e

Choose a tag to compare

Key Changes

  • Support better capturing for cargo test
  • Don't print internal logs to stdout

Contributions

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

11 Nov 23:57
ebf4829

Choose a tag to compare

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

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

26 Aug 22:17
6b1b619

Choose a tag to compare

Key Changes

  • Add a public function for getting the default level style

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 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

04 Aug 00:08
5407365

Choose a tag to compare

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

23 Jul 22:11
211d566

Choose a tag to compare

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