[−][src]Crate flexi_logger
A flexible and easy-to-use logger that writes logs to stderr and/or to files or other output streams.
To read the log specification from an environment variable and get the log written to stderr,
start flexi_logger e.g. like this:
flexi_logger::Logger::with_env().start().unwrap();
See
- Logger for a full description of all configuration options,
- and the writers module for the usage of additional log writers,
- and the homepage for how to get started.
There are configuration options to e.g.
- decide whether you want to write your logs to stderr or to a file,
- configure the path and the filenames of the log files,
- use file rotation,
- specify the line format for the log lines,
- define additional log output streams, e.g for alert or security messages,
- support changing the log specification while the program is running,
flexi_logger uses a similar syntax as env_logger
for specifying which logs should really be written (but is more graceful with the syntax,
and can provide error information).
Modules
| writers | Contains a trait ( |
Structs
| DeferredNow | Deferred timestamp creation. |
| LogSpecBuilder | Builder for |
| LogSpecification | Immutable struct that defines which loglines are to be written, based on the module, the log level, and the text. |
| Logger | The entry-point for using |
| ModuleFilter | Defines which loglevel filter to use for the specified module. |
| ReconfigurationHandle | Allows reconfiguring the logger programmatically. |
| Record | Re-exports from log crate The "payload" of a log message. |
Enums
| Age | The age after which a log file rotation will be triggered,
when |
| Cleanup | Defines the strategy for handling older log files. |
| Criterion | Criterion when to rotate the log file. |
| Duplicate | Used to control which messages are to be duplicated to stderr, when |
| FlexiLoggerError | Describes errors in the initialization of |
| Level | Re-exports from log crate An enum representing the available verbosity levels of the logger. |
| LevelFilter | Re-exports from log crate An enum representing the available verbosity level filters of the logger. |
| LogTarget | Describes the default log target. |
| Naming | The naming convention for rotated log files. |
Functions
| colored_default_format | A colored version of the logline-formatter |
| colored_detailed_format | A colored version of the logline-formatter |
| colored_opt_format | A colored version of the logline-formatter |
| colored_with_thread | A colored version of the logline-formatter |
| default_format | A logline-formatter that produces log lines like |
| detailed_format | A logline-formatter that produces log lines like
|
| opt_format | A logline-formatter that produces log lines with timestamp and file location, like
|
| style | Helper function that is used in the provided colored format functions. |
| with_thread | A logline-formatter that produces log lines like
|
Type Definitions
| FormatFunction | Function type for Format functions. |