Module bdrck::logging[][src]

logging provides Logger implementations suitable for either command-line applications or serving daemons.

Modules

write

write provides adapters to use anything which implements Write as a logging destination.

Structs

LogFilter

A LogFilter is a single filter, perhaps one of many, that can be applied to log messages before actually outputting them.

LogFilters

LogFilters is a structure which defines the full set of filters a Logger should apply to log messages before actually outputting them.

Logger

This is the standard Log implementation bdrck provides, which can be controlled by setting its Options. In general, this is intended to be a pretty versatile implementation, suitable for both command-line applications as well as serving daemons, given the right Options.

Options

Options is a structure which describes the options for a Logger. Generally these should be constructed using OptionsBuilder, instead of filling in all fields by hand.

OptionsBuilder

OptionsBuilder provides a builder-style interface to construct an Options.

Functions

format_log_record

This function formats the given log Record into a string, which can then be written directly to the logging sink (e.g. stderr, a file, etc.).

init

This is a shortcut which just calls try_init(), but implicitly unwraps the resulting error. For applications which initialize a Logger first thing in main(), this is probably a reasonable choice.

parse_log_level_filter

This is a utility function which provides a way to parse a log::LevelFilter from a string. Upstream doesn't impl FromStr for this type, so this extra utility is necessary.

try_init

Try to set up a new global Logger, with the given Options controlling its behavior, returning a standard error if doing so fails in some way.