lunatic-log

A logging library for lunatic Rust applications

8 unstable releases (3 breaking)

0.4.0 May 5, 2023
0.3.0 Nov 15, 2022
0.2.3 Aug 9, 2022
0.1.1 Aug 8, 2022

#664 in Debugging

Download history 61/week @ 2024-07-01 8/week @ 2024-07-08 36/week @ 2024-07-15 14/week @ 2024-07-22 82/week @ 2024-07-29 27/week @ 2024-08-05 25/week @ 2024-08-12 26/week @ 2024-08-19 23/week @ 2024-08-26 21/week @ 2024-09-02 24/week @ 2024-09-09 12/week @ 2024-09-16 82/week @ 2024-09-23 38/week @ 2024-09-30 16/week @ 2024-10-07 44/week @ 2024-10-14

182 downloads per month
Used in 5 crates (4 directly)

Apache-2.0/MIT

33KB
632 lines

A logging library for lunatic Rust applications.

Why a new logging library?

Current logging solutions in Rust (log, tracing, ...) depend on global static variables that are initialized at the start of the app. This doesn't work in lunatic, where each process gets their own memory space. You would need to re-initialize the logger for each process, and that is not practical.

lunatic-log allows you to run a log subscriber process that collects logging messages from all running processes.

How to use lunatic-log?

Add it as a dependency:

lunatic-log = "0.2"

In your code:

use lunatic_log::{info, subscriber::fmt::FmtSubscriber, LevelFilter};

fn main() {
    // Initialize subscriber
    lunatic_log::init(FmtSubscriber::new(LevelFilter::Info).pretty());

    // Log message
    info!("Hello, {}", "World");

    // Wait for events to propagate and display before exiting app
    lunatic::sleep(std::time::Duration::from_millis(50));
}

License

Licensed under either of

at your option.

Dependencies

~2.7–3.5MB
~66K SLoC