Sha256: 741dad916fb73b03656c3cbcfae83d813e526218d7a2174aaad2519619aebed9
Contents?: true
Size: 1.06 KB
Versions: 2
Compression:
Stored size: 1.06 KB
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 error_id = CrashLog.notify(exception, :rack_env => env) env['crash_log.error_id'] = error_id raise end if env['rack.exception'] error_id = CrashLog.notify(env['rack.exception'], :rack_env => env) env['crash_log.error_id'] = error_id end response end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
crashlog-1.0.0.rc1 | lib/crash_log/rack.rb |
crashlog-0.0.2 | lib/crash_log/rack.rb |