Sha256: 19fd647b974aa07cf610ccad1272429559b619c869b4e9e8571f65e53ece8f82

Contents?: true

Size: 1.06 KB

Versions: 49

Compression:

Stored size: 1.06 KB

Contents

# frozen_string_literal: true

module LHS
  module Interceptors
    module ExtendedRollbar
      class Handler

        def self.init
          proc do |options|
            # as handlers cant influence what actually is reported to rollbar
            # this just makes sure that Rollbar is already loaded when this class is loaded,
            # so that we can extend rollbar loging
          end
        end

        module ExtendedLogging
          def log(level, *args)
            args[2] = {} if args[2].nil?
            args[2][:lhs] = LHS::Interceptors::ExtendedRollbar::ThreadRegistry.log.map do |entry|
              {
                request: entry[:request].options,
                response: {
                  code: entry[:response].code,
                  body: entry[:response].body
                }
              }
            end.to_json
            super
          end
        end

        module ::Rollbar
          class Notifier
            prepend LHS::Interceptors::ExtendedRollbar::Handler::ExtendedLogging
          end
        end
      end
    end
  end
end

Version data entries

49 entries across 49 versions & 1 rubygems

Version Path
lhs-22.1.1.pre lib/lhs/interceptors/extended_rollbar/handler.rb
lhs-22.1.0 lib/lhs/interceptors/extended_rollbar/handler.rb
lhs-22.0.0 lib/lhs/interceptors/extended_rollbar/handler.rb
lhs-21.3.1 lib/lhs/interceptors/extended_rollbar/handler.rb
lhs-21.3.0 lib/lhs/interceptors/extended_rollbar/handler.rb
lhs-21.3.0.pre.autoauth.1 lib/lhs/interceptors/extended_rollbar/handler.rb
lhs-21.2.4 lib/lhs/interceptors/extended_rollbar/handler.rb
lhs-21.2.3 lib/lhs/interceptors/extended_rollbar/handler.rb
lhs-21.2.3.pre.preload.pre.providers.pre.too.1 lib/lhs/interceptors/extended_rollbar/handler.rb
lhs-21.2.2 lib/lhs/interceptors/extended_rollbar/handler.rb
lhs-21.2.1 lib/lhs/interceptors/extended_rollbar/handler.rb
lhs-21.2.0 lib/lhs/interceptors/extended_rollbar/handler.rb
lhs-21.1.4 lib/lhs/interceptors/extended_rollbar/handler.rb
lhs-21.1.3 lib/lhs/interceptors/extended_rollbar/handler.rb
lhs-21.1.2 lib/lhs/interceptors/extended_rollbar/handler.rb
lhs-21.1.2.pre.keyfix.2 lib/lhs/interceptors/extended_rollbar/handler.rb
lhs-21.1.2.pre.keyfix.1 lib/lhs/interceptors/extended_rollbar/handler.rb
lhs-21.1.2.pre.fix.pre.cant.pre.add.pre.new.pre.key.pre.during.pre.iteration.1 lib/lhs/interceptors/extended_rollbar/handler.rb
lhs-21.1.1.pre.pre.fix.pre.cant.pre.add.pre.new.pre.key.pre.during.pre.iteration.1 lib/lhs/interceptors/extended_rollbar/handler.rb
lhs-21.1.0 lib/lhs/interceptors/extended_rollbar/handler.rb