Trait opentelemetry_sdk::logs::LogProcessor

source ·
pub trait LogProcessor:
    Send
    + Sync
    + Debug {
    // Required methods
    fn emit(&self, data: &mut LogData);
    fn force_flush(&self) -> LogResult<()>;
    fn shutdown(&self) -> LogResult<()>;

    // Provided method
    fn set_resource(&self, _resource: &Resource) { ... }
}
Expand description

The interface for plugging into a Logger.

Required Methods§

source

fn emit(&self, data: &mut LogData)

Called when a log record is ready to processed and exported.

This method receives a mutable reference to LogData. If the processor needs to handle the export asynchronously, it should clone the data to ensure it can be safely processed without lifetime issues. Any changes made to the log data in this method will be reflected in the next log processor in the chain.

§Parameters
  • data: A mutable reference to LogData representing the log record.
source

fn force_flush(&self) -> LogResult<()>

Force the logs lying in the cache to be exported.

source

fn shutdown(&self) -> LogResult<()>

Shuts down the processor. After shutdown returns the log processor should stop processing any logs. It’s up to the implementation on when to drop the LogProcessor.

Provided Methods§

source

fn set_resource(&self, _resource: &Resource)

Set the resource for the log processor.

Implementors§