Method: L2Metable#log_exception

Defined in:
lib/l2metable.rb

#log_exception(subcomponent, e, extras = {}) ⇒ Object



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/l2metable.rb', line 69

def log_exception(subcomponent, e, extras = {})
  exception_suffix = "exception"
  extras = {:at => dotted(log_component(subcomponent), exception_suffix)}.merge(extras)

  if e.nil? || !e.is_a?(Exception)
    measure(exception_suffix, 1, extras)
    return
  end

  exception_id = e.object_id.abs
  trace = e.backtrace.reduce do |memo, line|
    memo + line.gsub(/[`'"]/, "") + "\n"
  end
  measure(exception_suffix, 1, {
    :exception_id => exception_id,
    :class => e.class,
    :message => e.message,
    :trace => trace
  }.merge(extras))
end