lib/semantic_logger/appender/bugsnag.rb in semantic_logger-2.14.0 vs lib/semantic_logger/appender/bugsnag.rb in semantic_logger-2.15.0
- old
+ new
@@ -52,11 +52,13 @@
end
# Returns [Hash] of parameters to send to Bugsnag.
def default_formatter
proc do |log|
- { :severity => log_level(log), tags: log.tags }.merge(log.payload || {})
+ h = { severity: log_level(log), tags: log.tags }
+ h.merge!(log.payload) if log.payload
+ h
end
end
# Send an error notification to Bugsnag
def log(log)
@@ -67,15 +69,16 @@
# Ignore logs coming from Bugsnag itself
return false if log.message.to_s.include?(Bugsnag::LOG_PREFIX)
# For more documentation on the Bugsnag.notify method see:
# https://bugsnag.com/docs/notifiers/ruby#sending-handled-exceptions
- Bugsnag.notify(log.exception || log.message, formatter.call(log))
+ Bugsnag.notify(log.exception || RuntimeError.new(log.message), formatter.call(log))
true
end
private
def log_level(log)
- log.level.to_s.gsub('warn', 'warning')
+ return 'warning' if log.level == :warn
+ log.level.to_s
end
end