Class: Locomotive::Steam::Server::Logging
- Inherits:
-
Middleware
- Object
- Middleware
- Locomotive::Steam::Server::Logging
- Defined in:
- lib/locomotive/steam/server/logging.rb
Overview
Track the request into the current logger
Instance Attribute Summary
Attributes inherited from Middleware
#app, #content_entry, #liquid_assigns, #mounting_point, #page, #path, #request
Instance Method Summary collapse
Methods inherited from Middleware
Constructor Details
This class inherits a constructor from Locomotive::Steam::Server::Middleware
Instance Method Details
#call(env) ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/locomotive/steam/server/logging.rb', line 8 def call(env) now = Time.now log "Started #{env['REQUEST_METHOD'].upcase} \"#{env['PATH_INFO']}\" at #{now}".light_white app.call(env).tap do |response| done_in_ms = ((Time.now - now) * 10000).truncate / 10.0 log "Completed #{code_to_human(response.first)} in #{done_in_ms}ms\n\n".green end end |