NVIDIA DeepStream SDK API Reference

9.2 Release
sdk::logs::LoggerContext Class Reference

Detailed Description

A class which stores the LoggerContext context.

This class meets the following design criteria:

  • A shared reference between LoggerProvider and Logger instantiated.
  • A thread-safe class that allows updating/altering processor/exporter pipelines and sampling config.
  • The owner/destroyer of Processors/Exporters. These will remain active until this class is destroyed. I.e. Sampling, Exporting, flushing, Custom Iterator etc. are all ok if this object is alive, and they will work together. If this object is destroyed, then no shared references to Processor, Exporter, Recordable, Custom Iterator etc. should exist, and all associated pipelines will have been flushed.

Definition at line 35 of file includes/opentelemetry/sdk/logs/logger_context.h.

Public Member Functions

 LoggerContext (std::vector< std::unique_ptr< LogRecordProcessor >> &&processors, const opentelemetry::sdk::resource::Resource &resource=opentelemetry::sdk::resource::Resource::Create({}), std::unique_ptr< instrumentationscope::ScopeConfigurator< LoggerConfig >> logger_configurator=std::make_unique< instrumentationscope::ScopeConfigurator< LoggerConfig >>(instrumentationscope::ScopeConfigurator< LoggerConfig >::Builder(LoggerConfig::Default()) .Build())) noexcept
 
void AddProcessor (std::unique_ptr< LogRecordProcessor > processor) noexcept
 Attaches a log processor to list of configured processors to this logger context. More...
 
LogRecordProcessor & GetProcessor () const noexcept
 Obtain the configured (composite) processor. More...
 
const opentelemetry::sdk::resource::Resource & GetResource () const noexcept
 Obtain the resource associated with this tracer context. More...
 
const instrumentationscope::ScopeConfigurator< LoggerConfig > & GetLoggerConfigurator () const noexcept
 Obtain the ScopeConfigurator with this logger context. More...
 
bool ForceFlush (std::chrono::microseconds timeout=(std::chrono::microseconds::max)()) noexcept
 Force all active LogProcessors to flush any buffered logs within the given timeout. More...
 
bool Shutdown (std::chrono::microseconds timeout=(std::chrono::microseconds::max)()) noexcept
 Shutdown the log processor associated with this tracer provider. More...
 
 LoggerContext (std::vector< std::unique_ptr< LogRecordProcessor >> &&processors, const opentelemetry::sdk::resource::Resource &resource=opentelemetry::sdk::resource::Resource::Create({}), std::unique_ptr< instrumentationscope::ScopeConfigurator< LoggerConfig >> logger_configurator=std::make_unique< instrumentationscope::ScopeConfigurator< LoggerConfig >>(instrumentationscope::ScopeConfigurator< LoggerConfig >::Builder(LoggerConfig::Default()) .Build())) noexcept
 
void AddProcessor (std::unique_ptr< LogRecordProcessor > processor) noexcept
 Attaches a log processor to list of configured processors to this logger context. More...
 
LogRecordProcessor & GetProcessor () const noexcept
 Obtain the configured (composite) processor. More...
 
const opentelemetry::sdk::resource::Resource & GetResource () const noexcept
 Obtain the resource associated with this tracer context. More...
 
const instrumentationscope::ScopeConfigurator< LoggerConfig > & GetLoggerConfigurator () const noexcept
 Obtain the ScopeConfigurator with this logger context. More...
 
bool ForceFlush (std::chrono::microseconds timeout=(std::chrono::microseconds::max)()) noexcept
 Force all active LogProcessors to flush any buffered logs within the given timeout. More...
 
bool Shutdown (std::chrono::microseconds timeout=(std::chrono::microseconds::max)()) noexcept
 Shutdown the log processor associated with this tracer provider. More...
 

Constructor & Destructor Documentation

◆ LoggerContext() [1/2]

sdk::logs::LoggerContext::LoggerContext ( std::vector< std::unique_ptr< LogRecordProcessor >> &&  processors,
const opentelemetry::sdk::resource::Resource &  resource = opentelemetry::sdk::resource::Resource::Create({}),
std::unique_ptr< instrumentationscope::ScopeConfigurator< LoggerConfig >>  logger_configurator = std::make_unique< instrumentationscope::ScopeConfigurator< LoggerConfig >>(instrumentationscope::ScopeConfigurator< LoggerConfig >::Builder(LoggerConfig::Default()) .Build()) 
)
explicitnoexcept

◆ LoggerContext() [2/2]

sdk::logs::LoggerContext::LoggerContext ( std::vector< std::unique_ptr< LogRecordProcessor >> &&  processors,
const opentelemetry::sdk::resource::Resource &  resource = opentelemetry::sdk::resource::Resource::Create({}),
std::unique_ptr< instrumentationscope::ScopeConfigurator< LoggerConfig >>  logger_configurator = std::make_unique< instrumentationscope::ScopeConfigurator< LoggerConfig >>(instrumentationscope::ScopeConfigurator< LoggerConfig >::Builder(LoggerConfig::Default()) .Build()) 
)
explicitnoexcept

Member Function Documentation

◆ AddProcessor() [1/2]

void sdk::logs::LoggerContext::AddProcessor ( std::unique_ptr< LogRecordProcessor >  processor)
noexcept

Attaches a log processor to list of configured processors to this logger context.

Processor once attached can't be removed.

Parameters
processorThe new log processor for this tracer. This must not be a nullptr. Ownership is given to the LoggerContext.

Note: This method is not thread safe.

◆ AddProcessor() [2/2]

void sdk::logs::LoggerContext::AddProcessor ( std::unique_ptr< LogRecordProcessor >  processor)
noexcept

Attaches a log processor to list of configured processors to this logger context.

Processor once attached can't be removed.

Parameters
processorThe new log processor for this tracer. This must not be a nullptr. Ownership is given to the LoggerContext.

Note: This method is not thread safe.

◆ ForceFlush() [1/2]

bool sdk::logs::LoggerContext::ForceFlush ( std::chrono::microseconds  timeout = (std::chrono::microseconds::max)())
noexcept

Force all active LogProcessors to flush any buffered logs within the given timeout.

◆ ForceFlush() [2/2]

bool sdk::logs::LoggerContext::ForceFlush ( std::chrono::microseconds  timeout = (std::chrono::microseconds::max)())
noexcept

Force all active LogProcessors to flush any buffered logs within the given timeout.

◆ GetLoggerConfigurator() [1/2]

const instrumentationscope::ScopeConfigurator<LoggerConfig>& sdk::logs::LoggerContext::GetLoggerConfigurator ( ) const
noexcept

Obtain the ScopeConfigurator with this logger context.

Returns
The ScopeConfigurator for this logger context.

◆ GetLoggerConfigurator() [2/2]

const instrumentationscope::ScopeConfigurator<LoggerConfig>& sdk::logs::LoggerContext::GetLoggerConfigurator ( ) const
noexcept

Obtain the ScopeConfigurator with this logger context.

Returns
The ScopeConfigurator for this logger context.

◆ GetProcessor() [1/2]

LogRecordProcessor& sdk::logs::LoggerContext::GetProcessor ( ) const
noexcept

Obtain the configured (composite) processor.

Note: When more than one processor is active, this will return an "aggregate" processor

◆ GetProcessor() [2/2]

LogRecordProcessor& sdk::logs::LoggerContext::GetProcessor ( ) const
noexcept

Obtain the configured (composite) processor.

Note: When more than one processor is active, this will return an "aggregate" processor

◆ GetResource() [1/2]

const opentelemetry::sdk::resource::Resource& sdk::logs::LoggerContext::GetResource ( ) const
noexcept

Obtain the resource associated with this tracer context.

Returns
The resource for this tracer context.

◆ GetResource() [2/2]

const opentelemetry::sdk::resource::Resource& sdk::logs::LoggerContext::GetResource ( ) const
noexcept

Obtain the resource associated with this tracer context.

Returns
The resource for this tracer context.

◆ Shutdown() [1/2]

bool sdk::logs::LoggerContext::Shutdown ( std::chrono::microseconds  timeout = (std::chrono::microseconds::max)())
noexcept

Shutdown the log processor associated with this tracer provider.

◆ Shutdown() [2/2]

bool sdk::logs::LoggerContext::Shutdown ( std::chrono::microseconds  timeout = (std::chrono::microseconds::max)())
noexcept

Shutdown the log processor associated with this tracer provider.


The documentation for this class was generated from the following file: