Class: Hanami::Providers::Rack Private
- Inherits:
-
Hanami::Provider::Source
- Object
- Dry::System::Provider::Source
- Hanami::Provider::Source
- Hanami::Providers::Rack
- Defined in:
- lib/hanami/providers/rack.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Provider source to register Rack integration components in Hanami slices.
Instance Attribute Summary
Attributes inherited from Hanami::Provider::Source
Instance Method Summary collapse
- #prepare ⇒ Object private
- #start ⇒ Object private
Methods inherited from Hanami::Provider::Source
#initialize, #target_container
Constructor Details
This class inherits a constructor from Hanami::Provider::Source
Instance Method Details
#prepare ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/hanami/providers/rack.rb', line 17 def prepare Dry::Monitor.load_extensions(:rack) # Explicitly register the Rack middleware events on our notifications bus. The Dry::Monitor # rack extension (activated above) does register these globally, but if the notifications # bus has been used before this provider loads, then it will have created its own separate # local copy of all registered events as of that moment in time, which will not be included # in the Rack events globally registered above. notifications = target["notifications"] notifications.register_event(Dry::Monitor::Rack::Middleware::REQUEST_START) notifications.register_event(Dry::Monitor::Rack::Middleware::REQUEST_STOP) notifications.register_event(Dry::Monitor::Rack::Middleware::REQUEST_ERROR) end |
#start ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/hanami/providers/rack.rb', line 32 def start slice.start :logger monitor_middleware = Dry::Monitor::Rack::Middleware.new( target["notifications"], clock: Dry::Monitor::Clock.new(unit: :microsecond) ) rack_logger = Hanami::Web::RackLogger.new(target[:logger], env: slice.container.env) rack_logger.attach(monitor_middleware) register "monitor", monitor_middleware end |