Expand description
Library providing functionalities to set and capture log_id::LogId
s.
Usage:
use once_cell::sync::Lazy;
use logid::{log_id::{LogId, EventLevel, get_log_id}, id_map::LogIdMap, capturing::LogIdTracing};
const SOME_ERROR: LogId = get_log_id(0, 0, EventLevel::Error, 0);
static GLOBAL_LOG_MAP: Lazy<LogIdMap> = Lazy::new(LogIdMap::new);
logid::setup_logid_map!(&GLOBAL_LOG_MAP);
fn my_func() -> Result<usize, LogId> {
// some code ...
// on error
Err(set_event!(SOME_ERROR, "Some error message")
.add_debug("Add debug information").into()
)
}
Modules
- Contains the
LogIdEntry
definition used to capture messages for a log-id. - Contains the
LogId
type and functions to create log IDs
Macros
- Macro to convert an enum to a
LogId
. - Macro to setup public functions for useful
logid
functionalities for the implicitly setLogIdMap
. - Macro to set a log event that is captured in the implicitly set
LogIdMap
- Macro to set a log event.
- Macro to setup the macros
set_event!()
andlogid_map_functions!()
. Thelogid_map_functions!()
macro creates public functions to allow users of a crate restricted access to an internalLogIdMap
.