Module: LogStruct::Integrations::RackErrorHandler

Extended by:
IntegrationInterface, T::Sig
Defined in:
lib/log_struct/integrations/rack_error_handler.rb,
lib/log_struct/integrations/rack_error_handler/middleware.rb

Overview

Rack middleware integration for structured logging

Defined Under Namespace

Classes: Middleware

Class Method Summary collapse

Methods included from IntegrationInterface

setup

Class Method Details

.setup(config) ⇒ Boolean?

Set up Rack middleware for structured error logging

Parameters:

Returns:

  • (Boolean, nil)


18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/log_struct/integrations/rack_error_handler.rb', line 18

def self.setup(config)
  return nil unless RackSetup.enabled?(config)

  # Add structured logging middleware for security violations and errors
  # Need to insert before RemoteIp to catch IP spoofing errors it raises
  RackSetup.insert_before(
    ::ActionDispatch::RemoteIp,
    Integrations::RackErrorHandler::Middleware
  )

  true
end