Module: LogStruct::Integrations::Puma::ErrorLoggerPatch
- Extended by:
- T::Sig
- Defined in:
- lib/log_struct/integrations/puma.rb
Overview
Puma::ErrorLogger writes request errors (an exception the app didn't handle, a malformed request, an SSL error) as plain text to STDERR, with the request's query string. Log them as structured lines, with the method and path but not the query string, which LogStruct can't filter there.
Instance Method Summary collapse
Instance Method Details
#info(options = {}) ⇒ T.untyped
416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 |
# File 'lib/log_struct/integrations/puma.rb', line 416 def info( = {}) error = [:error] return super unless error.is_a?(Exception) env = [:req]&.env ::LogStruct.error(::LogStruct::Log::Puma::Error.new( error_class: error.class, message: error., backtrace: error.backtrace, error_context: [:text]&.to_s, http_method: env&.dig("REQUEST_METHOD"), path: env && (env["REQUEST_PATH"] || env["PATH_INFO"]) )) nil rescue => e ::LogStruct::Integrations::Puma.handle_integration_error(e) super end |