Class: LogWeasel::Middleware

Inherits:
Object
  • Object
show all
Defined in:
lib/log_weasel/middleware.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, options = {}) ⇒ Middleware

Returns a new instance of Middleware.



2
3
4
5
# File 'lib/log_weasel/middleware.rb', line 2

def initialize(app, options = {})
  @app = app
  @key = LogWeasel.config.key ? "#{LogWeasel.config.key}-WEB" : "WEB"
end

Instance Method Details

#call(env) ⇒ Object



7
8
9
10
11
12
# File 'lib/log_weasel/middleware.rb', line 7

def call(env)
  LogWeasel::Transaction.create @key
  @app.call(env)
ensure
  LogWeasel::Transaction.destroy
end