Method: SemanticLogger::Appender::NewRelic#log

Defined in:
lib/semantic_logger/appender/new_relic.rb

#log(log) ⇒ Object

Send an error notification to New Relic



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/semantic_logger/appender/new_relic.rb', line 48

def log(log)
  # Send error messages as Runtime exceptions
  exception =
    if log.exception
      log.exception
    else
      error = RuntimeError.new(log.message)
      error.set_backtrace(log.backtrace) if log.backtrace
      error
    end
  # For more documentation on the NewRelic::Agent.notice_error method see:
  # http://rubydoc.info/github/newrelic/rpm/NewRelic/Agent#notice_error-instance_method
  # and https://docs.newrelic.com/docs/ruby/ruby-agent-api
  ::NewRelic::Agent.notice_error(exception, formatter.call(log, self))
  true
end