Class: ApiValve::Middleware::Logging::Log
- Inherits:
-
Object
- Object
- ApiValve::Middleware::Logging::Log
- Defined in:
- lib/api_valve/middleware/logging.rb
Constant Summary collapse
- INCOMING =
%(Started %s "%s" for %s at %s).freeze
- COMPLETE =
%(Completed %s %s in %dms\n).freeze
- URL_PARAMS =
%(URL params %s).freeze
- REQUEST_PAYLOAD =
%(Request payload\n%s).freeze
- REQUEST_HEADERS =
%(Request HTTP Headers %s).freeze
- RESPONSE_HEADERS =
%(Response HTTP headers %s).freeze
- RESPONSE_PAYLOAD =
%(Response payload\n%s).freeze
- NON_STANDARD_REQUEST_HEADERS =
%w(CONTENT_LENGTH CONTENT_TYPE).freeze
Instance Attribute Summary collapse
-
#began_at ⇒ Object
Returns the value of attribute began_at.
-
#env ⇒ Object
Returns the value of attribute env.
-
#response_headers ⇒ Object
Returns the value of attribute response_headers.
-
#response_payload ⇒ Object
Returns the value of attribute response_payload.
-
#status ⇒ Object
Returns the value of attribute status.
Instance Method Summary collapse
- #after_request ⇒ Object
- #assign(options = {}) ⇒ Object
- #before_request ⇒ Object
-
#initialize(options = {}) ⇒ Log
constructor
A new instance of Log.
Constructor Details
#initialize(options = {}) ⇒ Log
Returns a new instance of Log.
17 18 19 |
# File 'lib/api_valve/middleware/logging.rb', line 17 def initialize( = {}) assign end |
Instance Attribute Details
#began_at ⇒ Object
Returns the value of attribute began_at.
15 16 17 |
# File 'lib/api_valve/middleware/logging.rb', line 15 def began_at @began_at end |
#env ⇒ Object
Returns the value of attribute env.
15 16 17 |
# File 'lib/api_valve/middleware/logging.rb', line 15 def env @env end |
#response_headers ⇒ Object
Returns the value of attribute response_headers.
15 16 17 |
# File 'lib/api_valve/middleware/logging.rb', line 15 def response_headers @response_headers end |
#response_payload ⇒ Object
Returns the value of attribute response_payload.
15 16 17 |
# File 'lib/api_valve/middleware/logging.rb', line 15 def response_payload @response_payload end |
#status ⇒ Object
Returns the value of attribute status.
15 16 17 |
# File 'lib/api_valve/middleware/logging.rb', line 15 def status @status end |
Instance Method Details
#after_request ⇒ Object
34 35 36 37 38 |
# File 'lib/api_valve/middleware/logging.rb', line 34 def after_request log_response_headers if Logging.log_response_headers log_response_payload if Logging.log_response_body log_response end |
#assign(options = {}) ⇒ Object
21 22 23 24 25 |
# File 'lib/api_valve/middleware/logging.rb', line 21 def assign( = {}) .each do |k, v| public_send "#{k}=", v end end |