Class: Skylight::Middleware Private
- Includes:
- Util::Logging
- Defined in:
- lib/skylight/middleware.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Defined Under Namespace
Classes: BodyProxy
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
private
For Util::Logging.
Instance Method Summary collapse
- #call(env) ⇒ Object private
-
#initialize(app, opts = {}) ⇒ Middleware
constructor
private
A new instance of Middleware.
Methods included from Util::Logging
#debug, #error, #info, #log, #t, #trace, trace?, #warn
Constructor Details
#initialize(app, opts = {}) ⇒ Middleware
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Middleware.
48 49 50 51 |
# File 'lib/skylight/middleware.rb', line 48 def initialize(app, opts={}) @app = app @config = opts[:config] end |
Instance Attribute Details
#config ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
For Util::Logging
46 47 48 |
# File 'lib/skylight/middleware.rb', line 46 def config @config end |
Instance Method Details
#call(env) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/skylight/middleware.rb', line 53 def call(env) if env["REQUEST_METHOD"] == "HEAD" t { "middleware skipping HEAD" } @app.call(env) else 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 |