Skip to content

Instantly share code, notes, and snippets.

@benoittgt
Created September 10, 2018 13:51
Show Gist options
  • Save benoittgt/b25b2a0b4937aaa145a39d69b90ffd4e to your computer and use it in GitHub Desktop.
Save benoittgt/b25b2a0b4937aaa145a39d69b90ffd4e to your computer and use it in GitHub Desktop.
display halted_callback in lograge
# frozen_string_literal: true
Rails.application.configure do
config.lograge.enabled = true
config.lograge.formatter = Lograge::Formatters::Logstash.new
config.lograge.custom_options = lambda do |event|
exceptions = %w[controller action format password]
{
uuid: event.payload[:uuid],
host: event.payload[:host],
halted_callback: halted_callback(event),
time: event.time,
params: event.payload[:params].except(*exceptions)
}
end
def halted_callback(event)
return nil unless event.children && event.children.any?
event.children.first.payload[:filter] if event.children.first.respond_to?(:payload)
end
end
@benoittgt
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment