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.
Most users will simply need to call
with the path to the log file and minimum log level:
use log::LevelFilter; simple_logging::log_to_file("test.log", LevelFilter::Info);
log_to_stderr() if simply logging to
use log::LevelFilter; simple_logging::log_to_stderr(LevelFilter::Info);
use log::LevelFilter; use std::io; simple_logging::log_to(io::sink(), LevelFilter::Info);
Each and every log message obeys the following fixed and easily-parsable format:
[<hh>:<mm>:<ss>.<SSS>] (<thread-id>) <level> <message>\n
<hh> denotes hours zero-padded to at least two digits,
denotes minutes zero-padded to two digits,
<ss> denotes seconds
zero-padded to two digits and
<SSS> denotes miliseconds zero-padded to
<thread-id> is an implementation-specific alphanumeric ID.
<level> is the log level as defined by
log::LogLevel and padded right
<message> is the log message. Note that
written to the log as-is, including any embedded newlines.
Any errors returned by the sink when writing are ignored.
The logger relies on a global
Mutex to serialize access to the user