class Elasticity::LogSubscriber
Public Instance Methods
multi_search(event)
click to toggle source
# File lib/elasticity/log_subscriber.rb, line 20 def multi_search(event) log_event(event) end
Private Instance Methods
log_event(event)
click to toggle source
# File lib/elasticity/log_subscriber.rb, line 26 def log_event(event) bt = event.payload[:backtrace] if bt.present? && defined?(Rails) bt = Rails.backtrace_cleaner.clean(bt) end message = "#{event.transaction_id} #{event.name} #{"%.2f" % event.duration}ms #{MultiJson.dump(event.payload[:args], pretty: Elasticity.config.pretty_json)}" if bt = event.payload[:backtrace] bt = Rails.backtrace_cleaner.clean(bt) if defined?(Rails) lines = bt[0,4].map { |l| color(l, GRAY) }.join("\n") message << "\n#{lines}" end debug(message) exception, message = event.payload[:exception] if exception error("#{event.transaction_id} #{event.name} ERROR #{exception}: #{message}") end end