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