Sha256: c3e746a782384807df7e42e3568c0d331fb58bceb58d3beefc89c039d1d85b4f

Contents?: true

Size: 538 Bytes

Versions: 20

Compression:

Stored size: 538 Bytes

Contents

require 'airbrake'
require 'faraday'



module Saddle
  module Middleware
    module Logging

      # Public: Log exceptions using the Rails logger
      #
      class RailsLogger < Faraday::Middleware

        def call(env)
          begin
            @app.call(env)
          rescue => e
            if defined?(Rails.logger)
              Rails.logger.error("#{env[:request][:saddle][:client].name} error: #{e}")
            end
            # Re-raise the error
            raise
          end
        end

      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
saddle-0.0.51 lib/saddle/middleware/logging/rails.rb
saddle-0.0.50 lib/saddle/middleware/logging/rails.rb
saddle-0.0.49 lib/saddle/middleware/logging/rails.rb
saddle-0.0.48 lib/saddle/middleware/logging/rails.rb
saddle-0.0.46 lib/saddle/middleware/logging/rails.rb
saddle-0.0.45 lib/saddle/middleware/logging/rails.rb
saddle-0.0.44 lib/saddle/middleware/logging/rails.rb
saddle-0.0.43 lib/saddle/middleware/logging/rails.rb
saddle-0.0.42 lib/saddle/middleware/logging/rails.rb
saddle-0.0.41 lib/saddle/middleware/logging/rails.rb
saddle-0.0.38 lib/saddle/middleware/logging/rails.rb
saddle-0.0.37 lib/saddle/middleware/logging/rails.rb
saddle-0.0.36 lib/saddle/middleware/logging/rails.rb
saddle-0.0.35 lib/saddle/middleware/logging/rails.rb
saddle-0.0.34 lib/saddle/middleware/logging/rails.rb
saddle-0.0.33 lib/saddle/middleware/logging/rails.rb
saddle-0.0.32 lib/saddle/middleware/logging/rails.rb
saddle-0.0.31 lib/saddle/middleware/logging/rails.rb
saddle-0.0.30 lib/saddle/middleware/logging/rails.rb
saddle-0.0.27 lib/saddle/middleware/logging/rails.rb