32 releases

0.5.6 Jun 20, 2018
0.5.5 Mar 25, 2018
0.5.4 Feb 18, 2018
0.5.1 Dec 26, 2017
0.1.3 Dec 28, 2014

#9 in Debugging

Download history 1984/week @ 2018-05-06 2371/week @ 2018-05-13 4038/week @ 2018-05-20 2768/week @ 2018-05-27 3774/week @ 2018-06-03 3476/week @ 2018-06-10 3237/week @ 2018-06-17 2918/week @ 2018-06-24 3731/week @ 2018-07-01 2800/week @ 2018-07-08 3426/week @ 2018-07-15 2799/week @ 2018-07-22 2744/week @ 2018-07-29

11,660 downloads per month

fern

Linux Build Status Windows Build Status Coverage Status

crates.io version badge

Simple, efficient logging for Rust.


Logging configuration is recursively branched, like a fern: formatting, filters, and output can be applied recursively to match increasingly specific kinds of logging. Fern provides a builder-based configuration backing for rust's standard log crate.

//! With fern, we can:

// Configure logger at runtime
fern::Dispatch::new()
    // Perform allocation-free log formatting
    .format(|out, message, record| {
        out.finish(format_args!(
            "{}[{}][{}] {}",
            chrono::Local::now().format("[%Y-%m-%d][%H:%M:%S]"),
            record.target(),
            record.level(),
            message
        ))
    })
    // Add blanket level filter -
    .level(log::LevelFilter::Debug)
    // - and per-module overrides
    .level_for("hyper", log::LevelFilter::Info)
    // Output to stdout, files, and other Dispatch configurations
    .chain(std::io::stdout())
    .chain(fern::log_file("output.log")?)
    // Apply globally
    .apply()?;

// and log using log crate macros!
info!("helllo, world!");

Examples of all features at the api docs. See fern in use with this example command line program.


Project Status

The fern project is primarily maintained by myself, @daboross on GitHub. It's a hobby project, but one I aim to keep at a high quality.

Contributing

As this is a hobby project, contributions are very welcome!

The easiest way for you to contribute right now is to use fern in your application, and see where it's lacking. The current library has a solid base, but it lacks features, and I may not anticipate your use cases.

If you have a use case fern does not cover, please file an issue. This is immensely useful to me, to anyone wanting to contribute to the project, and to you as well if the feature is implemented.

If you're interested in helping fix an existing issue, or an issue you just filed, help is appreciated.

See CONTRIBUTING for technical information on contributing.

MIT license

Dependencies

Reverse deps