Class: Vmpooler::API::RequestLogger
- Inherits:
-
Object
- Object
- Vmpooler::API::RequestLogger
- Defined in:
- lib/vmpooler/api/request_logger.rb
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ RequestLogger
constructor
A new instance of RequestLogger.
Constructor Details
#initialize(app, options = {}) ⇒ RequestLogger
Returns a new instance of RequestLogger.
8 9 10 11 |
# File 'lib/vmpooler/api/request_logger.rb', line 8 def initialize(app, = {}) @app = app @logger = [:logger] end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
6 7 8 |
# File 'lib/vmpooler/api/request_logger.rb', line 6 def app @app end |
Instance Method Details
#call(env) ⇒ Object
13 14 15 16 17 |
# File 'lib/vmpooler/api/request_logger.rb', line 13 def call(env) status, headers, body = @app.call(env) @logger.log('s', "[ ] API: Method: #{env['REQUEST_METHOD']}, Status: #{status}, Path: #{env['PATH_INFO']}, Body: #{body}") [status, headers, body] end |