pub fn init<P: AsRef<Path>>(
log_path: Option<P>,
appname: &str,
show_appname: bool,
debug: bool,
use_stdout: bool
) -> Result<()>
Expand description
Initialize default mlzlog settings.
log_path
is the base path for logfiles. The appname
is used as the base
name for the logfiles, with the current day appended. The logfile is rolled
over on midnight. A symbolic link named current
always links to the
latest file.
If log_path
is None
, no logfiles are written to disk.
The hardcoded setting of log_path
can be overridden by an environment
variabled named MLZ_LOG_PATH
. If it is empty, no logfiles are written,
else it specifies the new base path.
If show_appname
is true, the appname is prepended to console messages.
If debug
is true, debug messages are output. If use_stdout
is true, a
ConsoleAppender
is created to log to stdout.
Logger target filtering can be configured using the MLZ_LOG_FILTER
environment variable. Its syntax is “[+-]?target1,[+-]?target2,…” where
+
or no prefix enters the target into a whitelist, while -
enters it
into a blacklist. If there are no whitelist entries, anything not in the
blacklist will be let through.
The black- and whitelists are checked for the record’s target and then for
its parents (as given by rust::module::paths
). The first match wins.