Sha256: f14a454b92a844f4cbdaee1032860ca9a87d633cdca945504de104875938d5f6

Contents?: true

Size: 874 Bytes

Versions: 4

Compression:

Stored size: 874 Bytes

Contents

module Sentry
  module Rails
    module Breadcrumb
      module ActiveSupportLogger
        class << self
          def add(name, started, _finished, _unique_id, data)
            crumb = Sentry::Breadcrumb.new(
              data: data,
              category: name,
              timestamp: started.to_i
            )
            Sentry.add_breadcrumb(crumb)
          end

          def inject
            @subscriber = ::ActiveSupport::Notifications.subscribe(/.*/) do |name, started, finished, unique_id, data|
              # we only record events that has a started timestamp
              if started.is_a?(Time)
                add(name, started, finished, unique_id, data)
              end
            end
          end

          def detach
            ::ActiveSupport::Notifications.unsubscribe(@subscriber)
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sentry-rails-4.1.3 lib/sentry/rails/breadcrumb/active_support_logger.rb
sentry-rails-4.1.2 lib/sentry/rails/breadcrumb/active_support_logger.rb
sentry-rails-4.1.1 lib/sentry/rails/breadcrumb/active_support_logger.rb
sentry-rails-4.1.0 lib/sentry/rails/breadcrumb/active_support_logger.rb