Sha256: 9c6b8e85d1cfd0378a06b65d951ea459473947203a33c6c72b7e233233f37420
Contents?: true
Size: 1.21 KB
Versions: 20
Compression:
Stored size: 1.21 KB
Contents
module Timber module Integrations module Rack # Reponsible for capturing and logging HTTP server requests and response events. class HTTPEvents def initialize(app) @app = app end def call(env) start = Time.now request = Util::Request.new(env) Config.instance.logger.info do Events::HTTPServerRequest.new( headers: request.headers, host: request.host, method: request.request_method, path: request.path, port: request.port, query_string: request.query_string, request_id: request.request_id, # we insert this middleware after ActionDispatch::RequestId scheme: request.scheme ) end status, headers, body = @app.call(env) Config.instance.logger.info do time_ms = (Time.now - start) * 1000.0 Events::HTTPServerResponse.new( headers: headers, request_id: request.request_id, status: status, time_ms: time_ms ) end [status, headers, body] end end end end end
Version data entries
20 entries across 20 versions & 1 rubygems