Crate flexi_logger [−] [src]
A logger that can write the log to standard error or to a fresh file in a configurable folder and allows custom logline formats.
It had started as an extended copy of env_logger.
Usage
Add flexi_logger to the dependencies in your project's Cargo.toml.
[dependencies]
flexi_logger = "0.6"
log = "*"
and this to your crate root:
extern crate flexi_logger;
#[macro_use]
extern crate log;
The latter is needed because flexi_logger plugs into the standard Rust logging facade given
by the log crate,
and you use the log macros to write log lines from your code.
Early in the start-up of your program, call something like
use flexi_logger::Logger;
Logger::with_str("modx::mody = info")
// ... your configuration options go here ...
.start()
.unwrap_or_else(|e| panic!("Logger initialization failed with {}", e));
The configuration options allow e.g. to
- decide whether you want to write your logs to stderr or to a file,
- configure the filenames and the folder in which the log files are created,
- specify the line format for the log lines
See Logger for a full description of all configuration options.
Structs
| FlexiLogger |
Does the logging in the background, is normally not used directly. |
| LogConfig |
Internal struct for influencing the behavior of flexi_logger. |
| LogOptions |
[ Deprecated ] Deprecated. Use Logger instead. |
| LogRecord |
The "payload" of a log message. This structure is primarily used as a
parameter in the |
| LogSpecBuilder |
Builder for LogSpecification. |
| LogSpecification |
Immutable struct that defines which loglines are to be written, based on the module, the log level, and the text. |
| Logger |
The standard entry-point for using flexi_logger. |
| ReconfigurationHandle |
Allows reconfiguring the logger while it is in use (see Logger::start_reconfigurable()). |
Enums
| FlexiLoggerError |
Describes errors in the initialization of flexi_logger. |
| LogLevel |
An enum representing the available verbosity levels of the logging framework. |
| LogLevelFilter |
An enum representing the available verbosity level filters of the logging framework. |
Functions
| default_format |
A logline-formatter that produces log lines like |
| detailed_format |
A logline-formatter that produces log lines like
|
| init |
[ Deprecated ]
|
| opt_format |
A logline-formatter that produces log lines like
|
| with_thread |
A logline-formatter that produces log lines like
|