mod.rs |
Formatting for log records.
This module contains a [`Formatter`] that can be used to format log records
into without needing temporary allocations. Usually you won't need to worry
about the contents of this module and can use the `Formatter` like an ordinary
[`Write`].
# Formatting log records
The format used to print log records can be customised using the [`Builder::format`]
method.
Custom formats can apply different color and weight to printed values using
[`Style`] builders.
```
use std::io::Write;
let mut builder = env_logger::Builder::new();
builder.format(|buf, record| {
writeln!(buf, "{}: {}",
record.level(),
record.args())
});
```
[`Formatter`]: struct.Formatter.html
[`Style`]: struct.Style.html
[`Builder::format`]: ../struct.Builder.html#method.format
[`Write`]: https://doc.rust-lang.org/stable/std/io/trait.Write.html |
17974 |