Macro log_item

Source
macro_rules! log_item {
    ($label:expr, $description:expr, $function:expr) => { ... };
}
Expand description

Creates a LogItem struct that is annotated with the source file and line number where the log condition was discovered.

Takes three parameters, each of which may be a &'static str or String:

  • label: name of object this LogItem references (typically a JUMBF path reference)
  • description: human-readable reason for this LogItem to have been generated
  • function: name of the function generating this LogItem

ยงExample

let log = log_item!("test1", "test item 1", "test func");

assert_eq!(
    log,
    LogItem {
        kind: LogKind::Informational,
        label: Cow::Borrowed("test1"),
        crate_name: Cow::Borrowed(env!("CARGO_PKG_NAME")),
        crate_version: Cow::Borrowed(env!("CARGO_PKG_VERSION")),
        description: Cow::Borrowed("test item 1"),
        file: Cow::Borrowed(file!()),
        function: Cow::Borrowed("test func"),
        line: log.line,
        ..Default::default()
    }
);