Skip to main content

log

Macro log 

Source
macro_rules! log {
    ($msg:literal) => { ... };
    ($($arg:tt)*) => { ... };
}
Expand description

A macro to write a formatted string to the cFE System Log.

This macro provides a println!-like interface for CFE_ES_WriteToSysLog. It handles the necessary string formatting and C string conversion.

§Usage

use libcfs::log::syslog;
use libcfs::error::Result;

fn my_function() -> Result<()> {
    // Simple literal message
    log!("Starting task...")?;

    let event_count = 10;
    let status = 0;

    // Formatted message
    log!("Processed {} events with status {}", event_count, status)?;

    Ok(())
}

§Returns

This macro evaluates to a libcfs::error::Result<()>. It will return an error if the message cannot be formatted (e.g., too long for the internal buffer) or if CFE_ES_WriteToSysLog returns an error.