NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
crates.io, #254 most downloaded on crates.io
A logging implementation for `log` which is configured via an environment variable.
Latest stable
0.11.12
Last release 2 days ago
20 Nov 2026
Release timing varies
gaps range from 9 days to 10 months
Most releases are documented
notes for 40 of 58 stable releases
Nothing withdrawn
no release was ever pulled
12 years old
60 releases · first in 2015
Drag across the ruler to compare, or tap a release to open it.
[0.11.12] - 2026-11-20 Compatibility Updated MSRV to 1.85
[0.11.11] - 2026-06-25 Internal Updated env_filter
env_filterYour coding agent can read these notes before it upgrades. Set up the MCP server →
[0.11.10] - 2026-03-23 Internal Update dependencies
[0.11.9] - 2026-02-11
(kv) Deprecate the unstable-kv feature which may be removed in a future patch release
unstable-kv feature which may be removed in a future patch releasekv featureConfigurableFormat to build custom [Builder::format]s that leverage this[0.11.7] - 2025-03-10 Internal Replaced humantime with jiff
humantime with jiff[0.11.6] - 2024-12-20 Features Opt-in file and line rendering
Nothing published for this version
Nothing published for this version
Experimental support for key-value logging behind unstable-kv
unstable-kvNothing published for this version
fix(fmt): Fix passing of WriteStyle when using Target::Pipe by @Bobo1239 in https://github.com/rust-cli/env_logger/pull/302
Full Changelog: https://github.com/rust-cli/env_logger/compare/v0.11.0...v0.11.1
refactor(fmt): More anstream prep by @epage in https://github.com/rust-cli/env_logger/pull/297
Full Changelog: https://github.com/rust-cli/env_logger/compare/v0.10.2...v0.11.0
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:
env_logger::fmt::stylecustom_format.rs
uses anstyle via
Formatter::default_level_style
env_logger::fmt::Formatter::styleenv_logger::fmt::Formatter::default_styled_levelenv_logger::fmt::Styleenv_logger::fmt::Colorenv_logger::fmt::StyledValueenv_logger::filter in favor of env_filterMSRV changed to 1.71
NO_COLOR and CLICOLOR_FORCE, see https://bixense.com/clicolors/is_test(true)refactor: Move impls next to types by @epage in https://github.com/rust-cli/env_logger/pull/283
Full Changelog: https://github.com/rust-cli/env_logger/compare/v0.10.1...v0.10.2
color is disabledchore(deps): update actions/setup-python action to v4 by @renovate in https://github.com/rust-cli/env_logger/pull/253
HashMap with a Vec by @ChrisDenton in https://github.com/rust-cli/env_logger/pull/241Full Changelog: https://github.com/rust-cli/env_logger/compare/v0.10.0...v0.10.1
RUST_LOG documentationrefactor(gh): Follow standard template by @epage in https://github.com/rust-cli/env_logger/pull/244
Full Changelog: https://github.com/rust-cli/env_logger/compare/v0.9.3...v0.10.0
MSRV changed to 1.60 to hide optional dependencies
atty to is-terminalTo open room for changing dependencies:
termcolor feature to coloratty feature to auto-colorFix a regression from v0.9.2 where env_logger would fail to compile with the termcolor feature turned off.
Fix a regression from v0.9.2 where env_logger would fail to compile with the termcolor feature turned off.
Fix and un-deprecate Target::Pipe, which was basically not working at all before and deprecated in 0.9.1.
Fix and un-deprecate Target::Pipe, which was basically not working at all before and deprecated in 0.9.1.
Nothing published for this version
Default message format now prints the target instead of the module
Breaking Changes:
Improvements:
<!-- next-url --> [Unreleased]: https://github.com/rust-cli/env_logger/compare/v0.11.12...HEAD [0.11.12]: https://github.com/rust-cli/env_logger/compare/v0.11.11...v0.11.12 [0.11.11]: https://github.com/rust-cli/env_logger/compare/v0.11.10...v0.11.11 [0.11.10]: https://github.com/rust-cli/env_logger/compare/v0.11.9...v0.11.10 [0.11.9]: https://github.com/rust-cli/env_logger/compare/v0.11.8...v0.11.9 [0.11.8]: https://github.com/rust-cli/env_logger/compare/v0.11.7...v0.11.8 [0.11.7]: https://github.com/rust-cli/env_logger/compare/v0.11.6...v0.11.7 [0.11.6]: https://github.com/rust-cli/env_logger/compare/v0.11.5...v0.11.6 [0.11.5]: https://github.com/rust-cli/env_logger/compare/v0.11.4...v0.11.5 [0.11.4]: https://github.com/rust-cli/env_logger/compare/v0.11.3...v0.11.4 [0.11.3]: https://github.com/rust-cli/env_logger/compare/v0.11.2...v0.11.3 [0.11.2]: https://github.com/rust-cli/env_logger/compare/v0.11.1...v0.11.2 [0.11.1]: https://github.com/rust-cli/env_logger/compare/v0.11.0...v0.11.1 [0.11.0]: https://github.com/rust-cli/env_logger/compare/v0.10.2...v0.11.0 [0.10.2]: https://github.com/rust-cli/env_logger/compare/v0.10.1...v0.10.2 [0.10.1]: https://github.com/rust-cli/env_logger/compare/v0.10.0...v0.10.1 [0.10.0]: https://github.com/rust-cli/env_logger/compare/v0.9.3...v0.10.0 [0.9.3]: https://github.com/rust-cli/env_logger/compare/v0.9.2...v0.9.3 [0.9.2]: https://github.com/rust-cli/env_logger/compare/v0.9.0...v0.9.2 [0.9.0]: https://github.com/rust-cli/env_logger/compare/v0.8.4...v0.9.0
Allow writing logs to a custom output target (via Target::Pipe)
Improvements:
Target::Pipe)Bug fixes:
env_logger::Builders methods, as documentedSuffix customization for the default formatter (Builder::format_suffix) [#192]
New features:
Builder::format_suffix) [#192]Improvements:
Bug fixes:
rust-toolchain whose presence caused issues for a few people)Fixed a panic on io errors when writing to stdout / stderr (#184).
Fixed a panic on io errors when writing to stdout / stderr (#184).
Update links in the documentation that were pointing to the old repository location.
Update links in the documentation that were pointing to the old repository location.
env_logger::from_env has been deprecated in favor of env_logger::Builder::from_env
Breaking changes:
Improvements:
Deprecations:
env_logger::from_env has been deprecated in favor of env_logger::Builder::from_envThis release raises the minimum supported Rust version to 1.41.0.
@divergentdave Thread local fallback
Indent multiline messages by default
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.
@shepmaster Redirect people to GitHub Releases for changesn
Support better capturing for cargo test
cargo teststdoutBuilder::is_testThe 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.
Set a policy for changes to the default format
log optional (but enabled by default)log. That means compiling env_logger with default-features=false will result in a different experience than in 0.5.x.-Z minimal-versions on CIUsing 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.
Add a public function for getting the default level style
Formatter::default_level_styleThe 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()))
});
Add support for high-precision timestamps
Builder::default_format_timestamp_nanosThe 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_timestampCustom formats can get a precise timestamp instead of the default by calling the precise_timestamp method instead of the existing timestamp one.
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.
termcolor to 1.0rustc to 1.20.0The 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.
@Eijebong Update regex to 1.0 and bump version
Add some convenient methods for adding filter directives
filter_module and filter_levelAdds 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)Support setting default values for environment variables before initialising a logger
Env::filter_or and Env::write_style_orDefault 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:
impl Env {
fn filter_or<E, V>(self, filter_env: E, default: V) -> Self
where
E: Into<Cow<'a, str>>,
V: Into<Cow<'a, str>>;
fn write_style_or<E, V>(self, write_style_env: E, default: V) -> Self
where
E: Into<Cow<'a, str>>,
V: Into<Cow<'a, str>>;
}
In usage:
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_ENVTwo new constants are publicly exported that correspond to the default environment variable names used for the filters and style preferences.
@KodrAus Add from_env methods to Logger directly
This is a potentially breaking change
termcolor::Color API so it's no longer a public dependencyThis 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.
Allow toggling parts of the default format without having to write one from scratch
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:
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:
Builder::new()
.format(|buf, record| { ... })
.default_format_timestamp(false)
.init();
Is the same as:
Builder::new()
.format(|buf, record| { ... })
.init();
Setting a custom format won't clobber any values passed to default_format_* methods. That means:
Builder::new()
.default_format_timestamp(false)
.format(|buf, record| { ... })
.default_format()
.init();
Is the same as:
Builder::new()
.default_format_timestamp(false)
.init();
Builder::from_default_envA new from_default_env method that's a convenient way of calling from_env(env_logger::Env::default()).
Better panic message when attempting to initialise the global logger multiple times
humantime instead of chrono for formatting timestampsThe 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.
humantime for formatting timestamps. This replaces the dependency on chronoSupport _more intense_ variants of color using intensity. Call set_intense(true) to produce a lighter color, and set_intense(false) to produce the def
set_intense(true) to produce a lighter color, and set_intense(false) to produce the default color.fmt::Style::set_intenseDetect whether stdout/stderr is a tty and write styles accordingly. This fixes an issue with color control characters showing up logs piped to files
stdout/stderr is a tty and write styles accordingly. This fixes an issue with color control characters showing up logs piped to filesatty for interrogating stdout/stderrFixed a panic in some rare logging cases and updated some incorrect sample code in the readme
NOTE: These release notes are collected from the 0.5.0-rc.1 and 0.5.0-rc.2 release notes.
NOTE: These release notes are collected from the 0.5.0-rc.1 and 0.5.0-rc.2 release notes.
LogTarget has been renamed to TargetLogBuilder has been renamed to BuilderBuilder::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 StringBuilder::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 methodlog / deny debug impls, missing docs, and warnings.Thanks to everybody who helped make this release of env_logger happen!
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 generic T: Into<Env>, where Env is a container for the environment variables we care about. These methods can now be called in a few ways:
// 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.
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:
env_logger::init_from_env(Env::new().filter("MY_LOG"));
With a few From conversions, the above is also equivalent to:
env_logger::init_from_env("MY_LOG");
Whether or not we want to keep these conversions is up for discussion.
The color API has been refactored and made public so you can use them in your own formats:
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.
Call the timestamp method on a Formatter to get an opaque timestamp that can be logged. It'll be written in an RFC3339 format:
let ts = buf.timestamp();
writeline!(buf, "log at: {}", ts)
Tweak the log format to be more aligned
Adds a new builder property for whether or not to include colors. By default this is RUST_LOG_STYLE, 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 generic T: Into<Env>, where Env is a container for the environment variables we care about. These methods can now be called in a few ways:
// 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.
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:
env_logger::init_from_env(Env::new().filter("MY_LOG"));
With a few From conversions, the above is also equivalent to:
env_logger::init_from_env("MY_LOG");
Whether or not we want to keep these conversions is up for discussion.
The color API has been refactored and made public so you can use them in your own formats:
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.
Oh the Formatter.timestamp method is now also public so you can grab timestamps.
Support for using custom environment variables to parse the log level filter
LogTarget has been renamed to TargetLogBuilder has been renamed to BuilderBuilder::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 StringBuilder::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 methodlog / deny debug impls, missing docs, and warnings.Thanks to everybody who helped make this release of env_logger happen!
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
One column per quarter.