pub trait LogExporter:
Send
+ Sync
+ Debug {
// Required method
fn export(
&self,
batch: LogBatch<'_>,
) -> impl Future<Output = OTelSdkResult> + Send;
// Provided methods
fn shutdown_with_timeout(&self, _timeout: Duration) -> OTelSdkResult { ... }
fn shutdown(&self) -> OTelSdkResult { ... }
fn event_enabled(
&self,
_level: Severity,
_target: &str,
_name: Option<&str>,
) -> bool { ... }
fn set_resource(&mut self, _resource: &Resource) { ... }
}Expand description
LogExporter defines the interface that log exporters should implement.
Required Methods§
Sourcefn export(
&self,
batch: LogBatch<'_>,
) -> impl Future<Output = OTelSdkResult> + Send
fn export( &self, batch: LogBatch<'_>, ) -> impl Future<Output = OTelSdkResult> + Send
Exports a batch of log records and their associated instrumentation scopes.
The export method is responsible for sending a batch of log records to an external
destination. It takes a LogBatch as an argument, which contains references to the
log records and their corresponding instrumentation scopes. The method returns
a LogResult indicating the success or failure of the export operation.
§Arguments
batch- ALogBatchcontaining the log records and instrumentation scopes to be exported.
§Returns
A LogResult<()>, which is a result type indicating either a successful export (with
Ok(())) or an error (Err(LogError)) if the export operation failed.
Provided Methods§
Sourcefn shutdown_with_timeout(&self, _timeout: Duration) -> OTelSdkResult
fn shutdown_with_timeout(&self, _timeout: Duration) -> OTelSdkResult
Shuts down the exporter.
Sourcefn shutdown(&self) -> OTelSdkResult
fn shutdown(&self) -> OTelSdkResult
Shuts down the exporter with a default timeout.
Sourcefn event_enabled(
&self,
_level: Severity,
_target: &str,
_name: Option<&str>,
) -> bool
fn event_enabled( &self, _level: Severity, _target: &str, _name: Option<&str>, ) -> bool
Check if logs are enabled.
Sourcefn set_resource(&mut self, _resource: &Resource)
fn set_resource(&mut self, _resource: &Resource)
Set the resource for the exporter.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.