Class: Acfs::Middleware::Logger
- Defined in:
- lib/acfs/middleware/logger.rb
Overview
Log requests and responses.
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(app, options = {}) ⇒ Logger
constructor
A new instance of Logger.
- #logger ⇒ Object
- #response(res, nxt) ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(app, options = {}) ⇒ Logger
Returns a new instance of Logger.
10 11 12 13 |
# File 'lib/acfs/middleware/logger.rb', line 10 def initialize(app, = {}) super @logger = [:logger] if [:logger] end |
Instance Method Details
#logger ⇒ Object
20 21 22 |
# File 'lib/acfs/middleware/logger.rb', line 20 def logger @logger ||= ::Logger.new STDOUT end |
#response(res, nxt) ⇒ Object
15 16 17 18 |
# File 'lib/acfs/middleware/logger.rb', line 15 def response(res, nxt) logger.info "[ACFS] #{res.request.method.to_s.upcase} #{res.request.url} -> #{res.status}" nxt.call res end |