Sha256: 719d5831433bef2d9594a5d97e0b687652e03a5023723ad1a6d4932773e02eca
Contents?: true
Size: 1.04 KB
Versions: 1
Compression:
Stored size: 1.04 KB
Contents
# frozen_string_literal: true module Hanami # @api private module Providers # Provider source to register Rack integration components in Hanami slices. # # @see Hanami::Providers::Logger # @see Hanami::Web::RackLogger # @see https://github.com/rack/rack # @see https://dry-rb.org/gems/dry-monitor/ # # @api private # @since 2.0.0 class Rack < Dry::System::Provider::Source # @api private def prepare require "dry/monitor" require "hanami/web/rack_logger" Dry::Monitor.load_extensions(:rack) end # @api private def start target.start :logger notifications = target[:notifications] clock = Dry::Monitor::Clock.new(unit: :microsecond) monitor_middleware = Dry::Monitor::Rack::Middleware.new(notifications, clock: clock) rack_logger = Hanami::Web::RackLogger.new(target[:logger], env: target.env) rack_logger.attach(monitor_middleware) register "monitor", monitor_middleware end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hanami-2.0.0 | lib/hanami/providers/rack.rb |