Sha256: 0f9439ba3b07b9e32ad455b96e4eb089070de4819cbc3dbd66d298fd47a46542
Contents?: true
Size: 997 Bytes
Versions: 5
Compression:
Stored size: 997 Bytes
Contents
module CrashLog # CrashLog Middleware for Rack applications. Any errors raised by the upstream # application will be delivered to CrashLog and re-raised. # # Synopsis: # # require 'rack' # require 'crashlog' # # CrashLog.configure do |config| # config.api_key = 'project-api-key' # end # # app = Rack::Builder.app do # run lambda { |env| raise "Fully Racked" } # end # # use CrashLog::Rack # run app # # Use a standard CrashLog.configure call to configure your api key. class Rack def initialize(app) @app = app CrashLog.configuration.logger ||= Logger.new($stdout) end def call(env) begin response = @app.call(env) rescue Exception => exception CrashLog.notify_or_ignore(exception, :rack_env => env) raise end if env['rack.exception'] CrashLog.notify_or_ignore(env['rack.exception'], :rack_env => env) end response end end end
Version data entries
5 entries across 5 versions & 1 rubygems