lib/logstasher/rails_ext/action_controller/metal/instrumentation.rb in logstasher-0.5.3 vs lib/logstasher/rails_ext/action_controller/metal/instrumentation.rb in logstasher-0.6.0

- old
+ new

@@ -10,13 +10,20 @@ :path => (request.fullpath rescue "unknown") } LogStasher.add_default_fields_to_payload(raw_payload, request) + LogStasher.clear_request_context + LogStasher.add_default_fields_to_request_context(request) + ActiveSupport::Notifications.instrument("start_processing.action_controller", raw_payload.dup) ActiveSupport::Notifications.instrument("process_action.action_controller", raw_payload) do |payload| + if self.respond_to?(:logstasher_add_custom_fields_to_request_context) + logstasher_add_custom_fields_to_request_context(LogStasher.request_context) + end + result = super if self.respond_to?(:logtasher_add_custom_fields_to_payload) before_keys = raw_payload.keys.clone logtasher_add_custom_fields_to_payload(raw_payload) @@ -26,9 +33,13 @@ end payload[:status] = response.status append_info_to_payload(payload) LogStasher.store.each do |key, value| + payload[key] = value + end + + LogStasher.request_context.each do |key, value| payload[key] = value end result end end