Function libutils::logger
[−]
[src]
pub fn logger(
stderr_level: Level,
syslog_level: Level
) -> (Logger, GlobalLoggerGuard)
Create the root logger.
This constructs an appropriate root logger for the application.
We send the logs to two places. The syslog and stderr (properly colored and nicely formatted). We don't expect failures, but ignore them at the terminating loggers (stderr or syslog), but panic if there's an error sending to the logger thread.
The parameters describe on which level to log.
It also installs a compatibility layer for the log crate, for any libraries that may use it.
However, you need to keep the returned GlobalLoggerGuard
alive for the lifetime of the
application for it to work (store it into a named variable, not into _
).