• Stars
    star
    838
  • Rank 54,406 (Top 2 %)
  • Language
    Rust
  • License
    MIT License
  • Created almost 10 years ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Simple, efficient logging for Rust

fern

crates.io version badge Build Status Average time to resolve an issue

Simple, efficient logging for Rust.


fern 0.4.4, 0.5.*, 0.6.* security warning - colored feature + global allocator

One of our downstream dependencies, atty, through colored, has an unsoundness issue: https://rustsec.org/advisories/RUSTSEC-2021-0145.html.

This shows up in one situation: if you're using colored (the crate, or our feature), and a custom global allocator.

I will be releasing fern 0.7.0, removing colored as a dependency. This may add another color crate, or may just document usage of alternatives (such as owo-colors + enable-ansi-support).

In the meantime, if you're using #[global_allocator], I highly recommend removing the fern/colored feature.

Or, for minimal code changes, you can also enable the colored/no-colors feature:

cargo add colored --features no-color

With the no-color feature, the vulnerable code will still be present, but unless you use any of the following APIs manually, it will never be called:

See #113 for further discussion.


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!(
            "[{} {} {}] {}",
            humantime::format_rfc3339(std::time::SystemTime::now()),
            record.level(),
            record.target(),
            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!("hello, 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.

More Repositories

1

screeps-starter-python

Starter Python AI for screeps, the JavaScript MMO game
Python
159
star
2

rust-throw

Compile time stack traces for Rust errors (no backtrace!)
Rust
75
star
3

screeps-rs

Work in progress native Screeps client.
Rust
29
star
4

serde-tuple-vec-map

Deserialize objects/maps into Vecs of key/value tuples.
Rust
18
star
5

rust-screeps-api

Rust library wrapping the https://screeps.com API
Rust
18
star
6

android_device_oneplus_dre9-twrp

WIP OnePlus Nord N200 5G NA-variant (codeword dre9) Device Tree for building Android 11 AOSP
Makefile
16
star
7

futures-example-2019

Example using Rust futures with async/await as of May 2019
Rust
11
star
8

wasm-wrapper-gen

JS->Rust binding generation for Rust compiled to Web Assembly (deprecated, use stdweb instead!)
Rust
9
star
9

srv

Terminal User Interface for the Screeps programming MMO
Rust
7
star
10

oneplus_dre8t_dre9_holi_notes

Personal notes on the OnePlus Nord N200 5G - codewords dre8t for T-Mobile edition, dre9 for NA edition, and sm4350 for SOC
5
star
11

zaldinar

Easily modable rust IRC bot
Rust
5
star
12

qxlc

Paste/link/image server written in Python 3 using Flask
Python
4
star
13

minecraft-commandline-interface

Command line minecraft client written in Java
Java
3
star
14

cardapio

Fork of cardapio (https://code.launchpad.net/cardapio)
Python
3
star
15

android_device_oneplus_holi_attempt1

Attempt 1 of TWRP android_device repository for the OnePlus Nord N200 5G (codeword holi)
C++
3
star
16

screeps-ai-v2

This is my second AI written for Screeps, active from July 2016 through October 2017
Python
2
star
17

RemoveGodItems

Bukkit plugin - Removes god items from player inventories
Java
2
star
18

screeps-warreport

Standalone python app to monitor battles happening in the programming game Screeps.
Python
2
star
19

MCScript

Bash script - Minecraft server management script
Shell
1
star
20

dotfiles

Some of my i3 config dotfiles!
Shell
1
star
21

mindjuice-rs

A simple and easy-to-use brainfuck interpreter, written for rust.
Rust
1
star
22

Eliralin

Eliralin patches for CloudBot - System based off of Spigot's patch system
Shell
1
star
23

bash-test-script

Test Script - Tests bash projects
Shell
1
star
24

screeps-pyconsole

Extremely simple python 3 screeps.com game console.
Python
1
star
25

simpler-conrod-example

Simplest conrod example I could come up with which doesn't cut performance corners
Rust
1
star
26

screeps-wasm-test

Rust WASM tests with the intention to use in Screeps
JavaScript
1
star
27

fern-macros-rs

Deprecated crate which used to accompany the 'fern' logging crate before Rust 1.0, and before fern 0.2.
Rust
1
star
28

PyPermissions

Python implementation of @SkyBirdSoar's RubyPerms
Python
1
star