Module: OpenTelemetry

Defined in:
lib/opentelemetry/logs.rb,
lib/opentelemetry/logs/logger.rb,
lib/opentelemetry/logs/version.rb,
lib/opentelemetry/logs/log_record.rb,
lib/opentelemetry/logs/logger_provider.rb,
lib/opentelemetry/logs/severity_number.rb,
lib/opentelemetry/internal/proxy_logger.rb,
lib/opentelemetry/internal/proxy_logger_provider.rb,
lib/opentelemetry-logs-api.rb

Overview

OpenTelemetry is an open source observability framework, providing a general-purpose API, SDK, and related tools required for the instrumentation of cloud-native software, frameworks, and libraries.

The OpenTelemetry module in the Logs API gem provides global accessors for logs-related objects.

Defined Under Namespace

Modules: Internal, Logs

Instance Method Summary collapse

Instance Method Details

#logger_providerObject, Logs::LoggerProvider

Returns registered logger provider or a default no-op implementation of the logger provider.

Returns:

  • (Object, Logs::LoggerProvider)

    registered logger provider or a default no-op implementation of the logger provider.



38
39
40
# File 'lib/opentelemetry-logs-api.rb', line 38

def logger_provider
  @mutex.synchronize { @logger_provider }
end

#logger_provider=(provider) ⇒ Object

Register the global logger provider.

Parameters:

  • provider (LoggerProvider)

    A logger provider to register as the global instance.



26
27
28
29
30
31
32
33
34
# File 'lib/opentelemetry-logs-api.rb', line 26

def logger_provider=(provider)
  @mutex.synchronize do
    if @logger_provider.instance_of? Internal::ProxyLoggerProvider
      logger.debug("Upgrading default proxy logger provider to #{provider.class}")
      @logger_provider.delegate = provider
    end
    @logger_provider = provider
  end
end