log4rs
Documentation is available at https://sfackler.github.io/log4rs/doc/v0.3.3/log4rs
log4rs is a highly configurable logging framework modeled after Java's Logback and log4j libraries.
log.toml:
# Scan this file for changes every 30 seconds
= 30
# An appender named "stdout" that writes to stdout
[]
= "console"
# An appender named "requests" that writes to a file with a custom pattern
[]
= "file"
= "log/requests.log"
= "%d - %m"
# Set the default logging level to "warn" and attach the "stdout" appender to the root
[]
= "warn"
= ["stdout"]
# Raise the maximum log level for events sent to the "app::backend::db" logger to "info"
[[]]
= "app::backend::db"
= "info"
# Route log events sent to the "app::requests" logger to the "requests" appender,
# and *not* the normal appenders installed at the root
[[]]
= "app::requests"
= "info"
= ["requests"]
= false
lib.rs:
extern crate log;
extern crate log4rs;
use Default;