lib/skylight/middleware.rb in skylight-0.3.12 vs lib/skylight/middleware.rb in skylight-0.3.13

- old
+ new

@@ -38,23 +38,32 @@ super if args.first.to_s =~ /^to_ary$/ @body.__send__(*args, &block) end end - def initialize(app) + include Util::Logging + + # For Util::Logging + attr_reader :config + + def initialize(app, opts={}) @app = app + @config = opts[:config] end def call(env) begin + t { "middleware beginning trace" } trace = Skylight.trace "Rack", 'app.rack.request' resp = @app.call(env) resp[2] = BodyProxy.new(resp[2]) { trace.submit } if trace resp rescue Exception + t { "middleware exception: #{trace}"} trace.submit if trace raise ensure + t { "middleware release: #{trace}"} trace.release if trace end end end end