Created
September 10, 2018 13:51
-
-
Save benoittgt/b25b2a0b4937aaa145a39d69b90ffd4e to your computer and use it in GitHub Desktop.
display halted_callback in lograge
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
or check roidrage/lograge#259