Sha256: 77b071c256f437f37d7d1becefab41c0818660562a1ab6ccb80d9307481e5826

Contents?: true

Size: 660 Bytes

Versions: 10

Compression:

Stored size: 660 Bytes

Contents

# frozen_string_literal: true

module Sbmt
  module KafkaProducer
    class ErrorTracker
      class << self
        def error(arr)
          logging(:error, arr)
        end

        private

        def logging(level, arr)
          return unless defined?(::Sentry)

          sentry_logging(level, arr) if ::Sentry.initialized?
        end

        def sentry_logging(level, arr)
          Sentry.with_scope do |_scope|
            if arr.is_a?(Exception)
              Sentry.capture_exception(arr, level: level)
            else
              Sentry.capture_message(arr, level: level)
            end
          end
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
sbmt-kafka_producer-3.2.0 lib/sbmt/kafka_producer/error_tracker.rb
sbmt-kafka_producer-3.1.1 lib/sbmt/kafka_producer/error_tracker.rb
sbmt-kafka_producer-3.1.0 lib/sbmt/kafka_producer/error_tracker.rb
sbmt-kafka_producer-3.0.0 lib/sbmt/kafka_producer/error_tracker.rb
sbmt-kafka_producer-2.2.3 lib/sbmt/kafka_producer/error_tracker.rb
sbmt-kafka_producer-2.2.2 lib/sbmt/kafka_producer/error_tracker.rb
sbmt-kafka_producer-2.2.1 lib/sbmt/kafka_producer/error_tracker.rb
sbmt-kafka_producer-2.2.0 lib/sbmt/kafka_producer/error_tracker.rb
sbmt-kafka_producer-2.1.0 lib/sbmt/kafka_producer/error_tracker.rb
sbmt-kafka_producer-2.0.0 lib/sbmt/kafka_producer/error_tracker.rb