Class: Napa::Middleware::Logger
- Inherits:
-
Object
- Object
- Napa::Middleware::Logger
- Includes:
- ParamSanitizer
- Defined in:
- lib/napa/middleware/logger.rb
Constant Summary
Constants included from ParamSanitizer
ParamSanitizer::KV_REGEXP, ParamSanitizer::PAIR_REGEXP
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ Logger
constructor
A new instance of Logger.
Methods included from ParamSanitizer
#filter_params, #filtered_parameters, #filtered_query_string, #parameter_filter
Constructor Details
#initialize(app) ⇒ Logger
Returns a new instance of Logger.
8 9 10 |
# File 'lib/napa/middleware/logger.rb', line 8 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/napa/middleware/logger.rb', line 12 def call(env) # log the request Napa::Logger.logger.info format_request(env) # process the request status, headers, body = @app.call(env) # log the response Napa::Logger.logger.debug format_response(status, headers, body) # return the results [status, headers, body] ensure # Clear the transaction id after each request Napa::LogTransaction.clear end |