class Rage::LogProcessor

def build_dynamic_context_proc

def build_dynamic_context_proc
  calls = @custom_context&.filter_map&.with_index do |context_object, i|
    if context_object.respond_to?(:call)
      "@custom_context[#{i}].call || DEFAULT_LOG_CONTEXT"
    end
  end
  return unless calls&.any?
  eval <<~RUBY
    ->() do
      {}.merge!(#{calls.join(", ")})
    end
  RUBY
end