Expand description
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())
});
Structs§
- A formatter to write logs into.
Enums§
- Log target, either
stdout
,stderr
or a custom pipe. - Formatting precision of timestamps.
- Whether or not to print styles to the target.