Sha256: 63b76c7ca767f512b782ec18ff249e8f3f2bbc8d214c855d95c5b04ae3e011b6

Contents?: true

Size: 1.32 KB

Versions: 1

Compression:

Stored size: 1.32 KB

Contents

# frozen_string_literal: true

# Copyright The OpenTelemetry Authors
#
# SPDX-License-Identifier: Apache-2.0

require 'opentelemetry'
require 'opentelemetry/logs'
require 'opentelemetry/logs/version'
require 'opentelemetry/internal/proxy_logger_provider'
require 'opentelemetry/internal/proxy_logger'

# 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.
module OpenTelemetry
  @logger_provider = Internal::ProxyLoggerProvider.new

  # Register the global logger provider.
  #
  # @param [LoggerProvider] provider A logger provider to register as the
  #   global instance.
  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

  # @return [Object, Logs::LoggerProvider] registered logger provider or a
  #   default no-op implementation of the logger provider.
  def logger_provider
    @mutex.synchronize { @logger_provider }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
opentelemetry-logs-api-0.1.0 lib/opentelemetry-logs-api.rb