Modules

Here are some examples for the flexi_logger initialization.

Error codes of flexi_logger.

This module contains two traits which allow adding a stateful filter using Logger::filter.

Contains the trait LogWriter for extending flexi_logger with additional log writers, and two concrete implementations for writing to files (FileLogWriter) or to the syslog ([SyslogWriter]). You can also use your own implementations of LogWriter.

Macros

Logs a message at the debug level.

Logs a message at the error level.

Logs a message at the info level.

Logs a message at the trace level.

Structs

Deferred timestamp creation.

Builder object for specifying the name and path of the log output file.

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.

Shuts down the logger when dropped, and allows reconfiguring the logger programmatically.

Defines which loglevel filter to use for the specified module.

The “payload” of a log message.

Enums

Can be used in Logger::adaptive_format_for_stderr and Logger::adaptive_format_for_stdout to use coloring only if the output goes to a tty.

The age after which a log file rotation will be triggered, when Criterion::Age is chosen.

Defines the strategy for handling older log files.

Criterion when to rotate the log file.

Used to control which messages are to be duplicated to stderr, when log_to_file() is used.

Enum for defining the output channel for flexi_logger’s own error messages.

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.

The naming convention for rotated log files.

Describes whether the log output should be written synchronously or asynchronously, and if and how I/O should be buffered and flushed.

Constants

Default buffer capacity (8k), when buffering is used.

Default flush interval (1s), when flushing is used.

Precompiled version of the time stamp format that is used by the provided format functions.

Functions

A colored version of the logline-formatter default_format that produces log lines like
ERROR [my_prog::some_submodule] File not found

A colored version of the logline-formatter detailed_format.

A colored version of the logline-formatter opt_format.

A colored version of the logline-formatter with_thread.

自定义日志配置

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.

根据feature来确定日志输出 dev:控制台输出 prod:在目录/var/local/log/{app}输出日志; 每天或大小达到10m更换日志文件; 维持10个日志文件; 生成/var/local/etc/{app}/logspecification.toml的动态配置文件

简单,纯粹想输出日志而已。适用于临时 控制台输出日志

A logline-formatter that produces log lines with timestamp and file location, like
[2016-01-13 15:25:01.640870 +01:00] INFO [src/foo/bar:26] Task successfully read from conf.json

Helper function that is used in the provided coloring format functions to apply colors based on the log level and the effective color palette.

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.