Expand description
Library providing functionalities to set and capture log_id::LogId
events.
log_id::LogId
s 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::LogId
s to receive events set with those log_id::LogId
s.
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)
}
Modules§
- event_
handler - evident
- evident makes it easy to create custom multithreaded pub/sub functionality. Communication is achieved by capturing events with distinct IDs, and forwarding those events to subscribers of the related IDs.
- log_id
- Contains the
LogId
struct. - logging
- macros
Macros§
- debug_
addon - err
- info_
addon - log
- new_
log_ id - Macro to create a
LogId
with a custom identifier andLogLevel
. - pipe
- set_
event - Macro to set an event.
- trace_
addon