Class LoggerProvider
Defined in File logger_provider.h
Inheritance Relationships
Base Type
public opentelemetry::logs::LoggerProvider
(Class LoggerProvider)
Class Documentation
-
class LoggerProvider : public opentelemetry::logs::LoggerProvider
Public Functions
-
explicit LoggerProvider(std::unique_ptr<LogRecordProcessor> &&processor, const opentelemetry::sdk::resource::Resource &resource = opentelemetry::sdk::resource::Resource::Create({})) noexcept
Initialize a new logger provider
- Parameters:
processor – The span processor for this logger provider. This must not be a nullptr.
resource – The resources for this logger provider.
-
explicit LoggerProvider(std::vector<std::unique_ptr<LogRecordProcessor>> &&processors, const opentelemetry::sdk::resource::Resource &resource = opentelemetry::sdk::resource::Resource::Create({})) noexcept
-
explicit LoggerProvider() noexcept
Initialize a new logger provider. A processor must later be assigned to this logger provider via the AddProcessor() method.
-
explicit LoggerProvider(std::unique_ptr<LoggerContext> context) noexcept
Initialize a new logger provider with a specified context
- Parameters:
context – The owned logger configuration/pipeline for this provider.
-
~LoggerProvider() override
-
nostd::shared_ptr<opentelemetry::logs::Logger> GetLogger(nostd::string_view logger_name, nostd::string_view library_name, nostd::string_view library_version = "", nostd::string_view schema_url = "", const opentelemetry::common::KeyValueIterable &attributes = opentelemetry::common::NoopKeyValueIterable()) noexcept override
Creates a logger with the given name, and returns a shared pointer to it. If a logger with that name already exists, return a shared pointer to it
- Parameters:
logger_name – The name of the logger to be created.
library_name – The version of the library.
library_version – The version of the library.
schema_url – The schema URL.
-
void AddProcessor(std::unique_ptr<LogRecordProcessor> processor) noexcept
Add the processor that is stored internally in the logger provider.
- Parameters:
processor – The processor to be stored inside the logger provider. This must not be a nullptr.
-
const opentelemetry::sdk::resource::Resource &GetResource() const noexcept
Obtain the resource associated with this logger provider.
- Returns:
The resource for this logger provider.
-
bool Shutdown() noexcept
Shutdown the log processor associated with this log provider.
-
bool ForceFlush(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept
Force flush the log processor associated with this log provider.
-
explicit LoggerProvider(std::unique_ptr<LogRecordProcessor> &&processor, const opentelemetry::sdk::resource::Resource &resource = opentelemetry::sdk::resource::Resource::Create({})) noexcept