#logger #log #logging

log4rs

A highly configurable multi-output logging implementation for the log facade

30 releases

0.9.0 Nov 29, 2019
0.8.3 Apr 3, 2019
0.8.1 Oct 17, 2018
0.8.0 Dec 26, 2017
0.3.1 Mar 26, 2015

#13 in Debugging

Download history 7370/week @ 2019-08-16 7443/week @ 2019-08-23 6155/week @ 2019-08-30 6696/week @ 2019-09-06 7638/week @ 2019-09-13 6596/week @ 2019-09-20 6736/week @ 2019-09-27 7737/week @ 2019-10-04 7669/week @ 2019-10-11 8765/week @ 2019-10-18 8600/week @ 2019-10-25 8275/week @ 2019-11-01 8725/week @ 2019-11-08 9318/week @ 2019-11-15 8849/week @ 2019-11-22

33,868 downloads per month
Used in 91 crates (51 directly)

MIT/Apache

180KB
4.5K SLoC

log4rs

CircleCI

log4rs is a highly configurable logging framework modeled after Java's Logback and log4j libraries.

Documentation

log4rs.yaml:

refresh_rate: 30 seconds
appenders:
  stdout:
    kind: console
  requests:
    kind: file
    path: "log/requests.log"
    encoder:
      pattern: "{d} - {m}{n}"
root:
  level: warn
  appenders:
    - stdout
loggers:
  app::backend::db:
    level: info
  app::requests:
    level: info
    appenders:
      - requests
    additive: false

lib.rs:

#[macro_use]
extern crate log;
extern crate log4rs;

fn main() {
    log4rs::init_file("config/log4rs.yaml", Default::default()).unwrap();

    info!("booting up");

    // ...
}

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~0.2–1MB
~20K SLoC