Class LogRecordProcessor

Inheritance Relationships

Derived Types

Class Documentation

class LogRecordProcessor

The Log Processor is responsible for passing log records to the configured exporter.

Subclassed by opentelemetry::sdk::logs::BatchLogRecordProcessor, opentelemetry::sdk::logs::MultiLogRecordProcessor, opentelemetry::sdk::logs::SimpleLogRecordProcessor

Public Functions

LogRecordProcessor() = default
LogRecordProcessor(const LogRecordProcessor&) = delete
LogRecordProcessor(LogRecordProcessor&&) = delete
LogRecordProcessor &operator=(const LogRecordProcessor&) = delete
LogRecordProcessor &operator=(LogRecordProcessor&&) = delete
virtual ~LogRecordProcessor() = default
virtual std::unique_ptr<Recordable> MakeRecordable() noexcept = 0

Create a log recordable. This requests a new log recordable from the associated exporter.

Note: This method must be callable from multiple threads.

Returns:

a newly initialized recordable

virtual void OnEmit(std::unique_ptr<Recordable> &&record) noexcept = 0

OnEmit is called by the SDK once a log record has been successfully created.

Parameters:

record – the log recordable object

inline bool Enabled(const opentelemetry::context::Context &context, const opentelemetry::sdk::instrumentationscope::InstrumentationScope &instrumentation_scope, opentelemetry::logs::Severity severity, opentelemetry::nostd::string_view event_name = {}) const noexcept

Enabled returns whether this processor is interested in a log with the given inputs. The default implementation is permissive and returns true.

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

Exports all log records that have not yet been exported to the configured Exporter.

Parameters:

timeout – that the forceflush is required to finish within.

Returns:

a result code indicating whether it succeeded, failed or timed out

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

Shuts down the processor and does any cleanup required. ShutDown should only be called once for each processor.

Parameters:

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

Returns:

true if the shutdown succeeded, false otherwise

Protected Functions

inline virtual bool EnabledImplementation(const opentelemetry::context::Context&, const opentelemetry::sdk::instrumentationscope::InstrumentationScope&, opentelemetry::logs::Severity, opentelemetry::nostd::string_view) const noexcept