lib/timber/integrations/rack/http_events.rb in timber-2.1.1 vs lib/timber/integrations/rack/http_events.rb in timber-2.1.2
- old
+ new
@@ -1,19 +1,19 @@
require "set"
require "timber/config"
require "timber/contexts/http"
require "timber/current_context"
-require "timber/events/http_server_request"
-require "timber/events/http_server_response"
+require "timber/events/http_request"
+require "timber/events/http_response"
require "timber/integrations/rack/middleware"
module Timber
module Integrations
module Rack
# A Rack middleware that is reponsible for capturing and logging HTTP server requests and
- # response events. The {Events::HTTPServerRequest} and {Events::HTTPServerResponse} events
+ # response events. The {Events::HTTPRequest} and {Events::HTTPResponse} events
# respectively.
class HTTPEvents < Middleware
class << self
# Allows you to capture the HTTP request body, default is off (false).
#
@@ -24,11 +24,11 @@
# 2. The {Events::ControllerCall} event captures the parsed parmaters sent to
# the controller. This is a parsed representation of the body, which is usually more
# helpful and redundant to the body captured here.
#
# If you opt to capture bodies, you can also truncate the size to reduce the data
- # captured. See {Events::HTTPServerRequest}.
+ # captured. See {Events::HTTPRequest}.
#
# @example
# Timber::Integrations::Rack::HTTPEvents.capture_request_body = true
def capture_request_body=(value)
@capture_request_body = value
@@ -37,11 +37,11 @@
# Accessor method for {#capture_request_body=}
def capture_request_body?
@capture_request_body == true
end
- # Just like {#capture_request_body=} but for the {Events::HTTPServerResponse} event.
+ # Just like {#capture_request_body=} but for the {Events::HTTPResponse} event.
# Please see {#capture_request_body=} for more details. The documentation there also
# applies here.
def capture_response_body=(value)
@capture_response_body = value
end
@@ -65,13 +65,13 @@
#
# Into this:
#
# Get "/" sent 200 OK in 79ms
#
- # The single event is still a {Timber::Events::HTTPServerResponse} event. Because
+ # The single event is still a {Timber::Events::HTTPResponse} event. Because
# we capture HTTP context, you still get the HTTP details, but you will not get
- # all of the request details that the {Timber::Events::HTTPServerRequest} event would
+ # all of the request details that the {Timber::Events::HTTPRequest} event would
# provide.
#
# @example
# Timber::Integrations::Rack::HTTPEvents.collapse_into_single_event = true
def collapse_into_single_event=(value)
@@ -126,11 +126,11 @@
Config.instance.logger.info do
http_context_key = Contexts::HTTP.keyspace
http_context = CurrentContext.fetch(http_context_key)
time_ms = (Time.now - start) * 1000.0
- Events::HTTPServerResponse.new(
+ Events::HTTPResponse.new(
headers: headers,
http_context: http_context,
request_id: request.request_id,
status: status,
time_ms: time_ms
@@ -143,11 +143,11 @@
start = Time.now
Config.instance.logger.info do
event_body = capture_request_body? ? request.body_content : nil
- Events::HTTPServerRequest.new(
+ Events::HTTPRequest.new(
body: event_body,
headers: request.headers,
host: request.host,
method: request.request_method,
path: request.path,
@@ -162,10 +162,10 @@
Config.instance.logger.info do
time_ms = (Time.now - start) * 1000.0
event_body = capture_response_body? ? body : nil
- Events::HTTPServerResponse.new(
+ Events::HTTPResponse.new(
body: event_body,
headers: headers,
request_id: request.request_id,
status: status,
time_ms: time_ms
\ No newline at end of file