Class: Ezlog::Rails::AccessLog
- Inherits:
-
Object
- Object
- Ezlog::Rails::AccessLog
- Includes:
- LogContextHelper
- Defined in:
- lib/ezlog/rails/access_log.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, logger, config) ⇒ AccessLog
constructor
A new instance of AccessLog.
Methods included from LogContextHelper
#add_to_log_context, #within_log_context
Constructor Details
#initialize(app, logger, config) ⇒ AccessLog
Returns a new instance of AccessLog.
6 7 8 9 10 |
# File 'lib/ezlog/rails/access_log.rb', line 6 def initialize(app, logger, config) @app = app @logger = logger @config = config end |
Instance Method Details
#call(env) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/ezlog/rails/access_log.rb', line 12 def call(env) status, headers, body_lines = benchmark { @app.call(env) } log_request ActionDispatch::Request.new(env), status [status, headers, body_lines] rescue Exception => ex log_request ActionDispatch::Request.new(env), ActionDispatch::ExceptionWrapper.status_code_for_exception(ex.class.name) raise end |