Module: LogStruct::Integrations::Rack

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

Overview

Rack middleware integration for structured logging

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)


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

def self.setup(config)
  return nil unless config.enabled
  return nil unless config.integrations.enable_rack_error_handler

  # Add structured logging middleware for security violations and errors
  # Need to insert after ShowExceptions to catch IP spoofing errors
  ::Rails.application.middleware.insert_after(
    ::ActionDispatch::ShowExceptions,
    Integrations::RackErrorHandler::Middleware
  )
  true
end