16 releases (10 breaking)

0.12.2 Aug 30, 2023
0.11.0 Jul 22, 2023
0.6.1 Mar 1, 2023
0.6.0 Nov 2, 2022
0.4.0 Jul 24, 2022

#183 in Debugging

Download history 1/week @ 2024-01-09 52/week @ 2024-01-16 1/week @ 2024-01-23 1/week @ 2024-02-13 14/week @ 2024-02-20 29/week @ 2024-02-27 58/week @ 2024-03-05 16/week @ 2024-03-12 6/week @ 2024-03-19 8/week @ 2024-03-26 31/week @ 2024-04-02

64 downloads per month
Used in 6 crates (5 directly)

MIT license

100KB
2.5K SLoC

logid

Rust logging framework using IDs to identify log events.

Using logid

use logid::{log_id::{LogId, LogLevel}, err, ErrLogId};
use thiserror::Error;

#[derive(Debug, Clone, ErrLogId, Error)]
enum CrateError {
    #[error("`SomeError` description.")]
    SomeError,

    #[error("`InternalError` description.")]
    InternalError,
}

fn my_func() -> Result<(), CrateError> {
    // some code ...
    
    // on error
    err!(CrateError::SomeError)
}

Contributing

There is not yet a contributing guideline, but feel free to create issues and/or pull requests.

Note that any contribution submitted to logid is going to be MIT licensed.

License

MIT Licensed


lib.rs:

Library providing functionalities to set and capture log_id::LogId events. log_id::LogIds are used to identify and group events. An event is captured by a central LOGGER once the event is finalized. Finalizing is done explicitly using .finalize(), converting the event back to the log_id::LogId, or implicitly when the event is dropped.

The LOGGER is created using [evident]'s Publisher struct. This allows to add subscribers to one or more log_id::LogIds to receive events set with those log_id::LogIds. For more information about subscription variants, checkout evident.

Usage:

use logid::{log_id::{LogId, LogLevel}, err, ErrLogId};
use thiserror::Error;

#[derive(Debug, Clone, ErrLogId, Error)]
enum CrateError {
    #[error("`SomeError` description.")]
    SomeError,

    #[error("`InternalError` description.")]
    InternalError,
}

fn my_func() -> Result<(), CrateError> {
    // some code ...

    // on error
    err!(CrateError::SomeError)
}

Dependencies

~0.9–11MB
~93K SLoC