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-26.2.0 lib/lhs/interceptors/extended_rollbar/handler.rb
lhs-26.1.0 lib/lhs/interceptors/extended_rollbar/handler.rb
lhs-26.0.1 lib/lhs/interceptors/extended_rollbar/handler.rb
lhs-26.0.0 lib/lhs/interceptors/extended_rollbar/handler.rb
lhs-25.2.0 lib/lhs/interceptors/extended_rollbar/handler.rb
lhs-25.1.0 lib/lhs/interceptors/extended_rollbar/handler.rb
lhs-25.0.4 lib/lhs/interceptors/extended_rollbar/handler.rb
lhs-25.0.3 lib/lhs/interceptors/extended_rollbar/handler.rb
lhs-25.0.2 lib/lhs/interceptors/extended_rollbar/handler.rb
lhs-25.0.1 lib/lhs/interceptors/extended_rollbar/handler.rb
lhs-25.0.0 lib/lhs/interceptors/extended_rollbar/handler.rb
lhs-24.1.2 lib/lhs/interceptors/extended_rollbar/handler.rb
lhs-24.1.1 lib/lhs/interceptors/extended_rollbar/handler.rb
lhs-24.1.0 lib/lhs/interceptors/extended_rollbar/handler.rb
lhs-24.1.0.pre.2 lib/lhs/interceptors/extended_rollbar/handler.rb
lhs-24.1.0.pre.1 lib/lhs/interceptors/extended_rollbar/handler.rb
lhs-24.0.0 lib/lhs/interceptors/extended_rollbar/handler.rb
lhs-23.0.2 lib/lhs/interceptors/extended_rollbar/handler.rb
lhs-23.0.1 lib/lhs/interceptors/extended_rollbar/handler.rb
lhs-23.0.0 lib/lhs/interceptors/extended_rollbar/handler.rb