lib/logstasher/action_view/log_subscriber.rb in logstasher-1.4.0 vs lib/logstasher/action_view/log_subscriber.rb in logstasher-2.0.0

- old
+ new

@@ -8,12 +8,12 @@ include CustomFields::LogSubscriber def render_template(event) logstash_event(event) end - alias :render_partial :render_template - alias :render_collection :render_template + alias render_partial render_template + alias render_collection render_template def logger LogStasher.logger end @@ -33,11 +33,11 @@ tags.push('exception') if data[:exception] logger << LogStasher.build_logstash_event(data, tags).to_json + "\n" end def extract_data(data) - { identifier: from_rails_root(data[:identifier]) } + { identifier: from_rails_root(data[:identifier]) } end def request_context LogStasher.request_context end @@ -47,19 +47,18 @@ end def event_data(event) { name: event.name, - transaction_id: event.transaction_id, + transaction_id: event.transaction_id } end def runtimes(event) { - duration: event.duration, - }.inject({}) do |runtimes, (name, runtime)| + duration: event.duration + }.each_with_object({}) do |(name, runtime), runtimes| runtimes[name] = runtime.to_f.round(2) if runtime - runtimes end end end end end