Crate logid

source ·
Expand description

Library providing functionalities to set and capture log_id::LogIds.

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

Macros

  • Macro to convert an enum to a LogId.
  • Macro to setup public functions for useful logid functionalities for the implicitly set LogIdMap.
  • 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!() and logid_map_functions!(). The logid_map_functions!() macro creates public functions to allow users of a crate restricted access to an internal LogIdMap.