Crate simple_logging [] [src]

A simple logger for the log facade. One log message is written per line. Each line also includes the time it was logged, the logging level and the ID of the thread. See SimpleLogger for more details.

Examples

Most users will simply need to call log_to_file() with the path to the log file and minimum log level:

use log::LogLevelFilter;

simple_logging::log_to_file("test.log", LogLevelFilter::Info);

Or use log_to_stderr() if simply logging to stderr:

use log::LogLevelFilter;

simple_logging::log_to_stderr(LogLevelFilter::Info);

For more control, log_to() can be used with an arbitrary sink implementing Write:

use log::LogLevelFilter;
use std::io;

simple_logging::log_to(io::sink(), LogLevelFilter::Info);

Performance

The logger relies on a global lock to serialize access to the user supplied sink.

Structs

SimpleLogger

A simple logger for the log facade.

Functions

log_to

Configure the log facade to log to a custom sink through a SimpleLogger.

log_to_file

Configure the log facade to log to a file through a SimpleLogger.

log_to_stderr

Configure the log facade to log to stderr through a SimpleLogger.