Crate flexi_logger

source ·
Expand description

A flexible and easy-to-use logger that writes logs to stderr and/or to files.

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 streams, e.g for alert or security messages,
  • support changing the log specification on the fly, while the program is running,

flexi_logger uses a similar syntax as env_logger for specifying which logs should really be written.

See Logger for a full description of all configuration options, and the writers module for the usage of additional log writers.

See the homepage for how to get started.

Modules

This module contains a trait for additional log writers, and a configurable concrete implementation for a log writer that writes to a file or a series of files.

Structs

Builder for LogSpecification.
Immutable struct that defines which loglines are to be written, based on the module, the log level, and the text.
The entry-point for using flexi_logger.
Allows reconfiguring the logger while it is in use (see Logger::start_reconfigurable() ).
The “payload” of a log message.

Enums

Used to control which messages are to be duplicated to stderr, when log_to_file() is used.
Re-exports from log crate Describes errors in the initialization of flexi_logger.
An enum representing the available verbosity levels of the logger.
An enum representing the available verbosity level filters of the logger.

Functions

A logline-formatter that produces log lines like
INFO [my_prog::some_submodule] Task successfully read from conf.json
A logline-formatter that produces log lines like
[2016-01-13 15:25:01.640870 +01:00] INFO [foo::bar] src/foo/bar.rs:26: Task successfully read from conf.json
i.e. with timestamp, module path and file location.
A logline-formatter that produces log lines like
[2016-01-13 15:25:01.640870 +01:00] INFO [src/foo/bar:26] Task successfully read from conf.json
i.e. with timestamp and file location.
A logline-formatter that produces log lines like
[2016-01-13 15:25:01.640870 +01:00] T[taskreader] INFO [src/foo/bar:26] Task successfully read from conf.json
i.e. with timestamp, thread name and file location.

Type Definitions

Function type for Format functions.