Sha256: 58c94be7402790ab5a839ff426ffc901998018dc75afcc3822f0498eb6452914

Contents?: true

Size: 1.35 KB

Versions: 1

Compression:

Stored size: 1.35 KB

Contents

# frozen_string_literal: true

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

module OpenTelemetry
  module Internal
    # @api private
    #
    # {ProxyLogger} is an implementation of {OpenTelemetry::Logs::Logger}. It is returned from
    # the ProxyLoggerProvider until a delegate logger provider is installed. After the delegate
    # logger provider is installed, the ProxyLogger will delegate to the corresponding "real"
    # logger.
    class ProxyLogger < Logs::Logger
      attr_writer :delegate

      # Returns a new {ProxyLogger} instance.
      #
      # @return [ProxyLogger]
      def initialize
        @delegate = nil
      end

      def on_emit(
        timestamp: nil,
        observed_timestamp: nil,
        severity_number: nil,
        severity_text: nil,
        body: nil,
        trace_id: nil,
        span_id: nil,
        trace_flags: nil,
        attributes: nil,
        context: nil
      )
        unless @delegate.nil?
          return @delegate.on_emit(
            timestamp: nil,
            observed_timestamp: nil,
            severity_number: nil,
            severity_text: nil,
            body: nil,
            trace_id: nil,
            span_id: nil,
            trace_flags: nil,
            attributes: nil,
            context: nil
          )
        end

        super
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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