Class LogRecordExporter

Class Documentation

class LogRecordExporter

LogRecordExporter defines the interface that log exporters must implement.

Public Functions

LogRecordExporter()
virtual ~LogRecordExporter()
virtual std::unique_ptr<Recordable> MakeRecordable() noexcept = 0

Create a log recordable. This object will be used to record log data and will subsequently be passed to LogRecordExporter::Export. Vendors can implement custom recordables or use the default ReadWriteLogRecord

recordable provided by the SDK.

Note: This method must be callable from multiple threads.

Returns:

a newly initialized Recordable object

virtual sdk::common::ExportResult Export(const nostd::span<std::unique_ptr<Recordable>> &records) noexcept = 0

Exports the batch of log records to their export destination. This method must not be called concurrently for the same exporter instance. The exporter may attempt to retry sending the batch, but should drop and return kFailure after a certain timeout.

Parameters:

records – a span of unique pointers to log records

Returns:

an ExportResult code (whether export was success or failure)

virtual bool ForceFlush(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept

Force flush the log records pushed into this log exporter.

virtual bool Shutdown(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept = 0

Marks the exporter as ShutDown and cleans up any resources as required. Shutdown should be called only once for each Exporter instance.

Parameters:

timeout – minimum amount of microseconds to wait for shutdown before giving up and returning failure.

Returns:

true if the exporter shutdown succeeded, false otherwise