Sha256: f5f5c51dbd2dda76cecc13f1bb14743ecfa60fd5be90c89ed0ec05f0db6fbf48

Contents?: true

Size: 658 Bytes

Versions: 2

Compression:

Stored size: 658 Bytes

Contents

# frozen_string_literal: true

require "dry/system/provider/source"

module Hanami
  module Providers
    class Rack < Dry::System::Provider::Source
      def prepare
        require "dry/monitor"
        require "hanami/web/rack_logger"

        Dry::Monitor.load_extensions(:rack)
      end

      def start
        target.start :logger

        notifications = target[:notifications]

        monitor_middleware = Dry::Monitor::Rack::Middleware.new(notifications)

        rack_logger = Hanami::Web::RackLogger.new(target[:logger])
        rack_logger.attach(monitor_middleware)

        register "monitor", monitor_middleware
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hanami-2.0.0.beta3 lib/hanami/providers/rack.rb
hanami-2.0.0.beta2 lib/hanami/providers/rack.rb