lib/semantic_logger/appender/bugsnag.rb in semantic_logger-4.6.1 vs lib/semantic_logger/appender/bugsnag.rb in semantic_logger-4.7.0
- old
+ new
@@ -1,9 +1,9 @@
begin
- require 'bugsnag'
+ require "bugsnag"
rescue LoadError
- raise LoadError.new('Gem bugsnag is required for logging purposes. Please add the gem "bugsnag" to your Gemfile.')
+ raise LoadError, 'Gem bugsnag is required for logging purposes. Please add the gem "bugsnag" to your Gemfile.'
end
# Send log messages to Bugsnag
#
# Example:
@@ -28,11 +28,11 @@
# RegExp: Only include log messages where the class name matches the supplied.
# regular expression. All other messages will be ignored.
# Proc: Only include log messages where the supplied Proc returns true
# The Proc must return true or false.
def initialize(level: :error, **args, &block)
- raise 'Bugsnag only supports :info, :warn, or :error log levels' unless %i[info warn error fatal].include?(level)
+ raise "Bugsnag only supports :info, :warn, or :error log levels" unless %i[info warn error fatal].include?(level)
# Replace the Bugsnag logger so that we can identify its log messages and not forward them to Bugsnag
::Bugsnag.configure { |config| config.logger = SemanticLogger[Bugsnag] }
super(level: level, **args, &block)
@@ -49,11 +49,11 @@
end
# Send an error notification to Bugsnag
def log(log)
# Ignore logs coming from Bugsnag itself
- return false if log.name == 'Bugsnag'
+ return false if log.name == "Bugsnag"
# Send error messages as Runtime exceptions
exception =
if log.exception
# Manually constructed Exception, without a backtrace.
@@ -75,14 +75,14 @@
# Bugsnag supports: error, warning or info
def log_level(log)
case log.level
when :error, :fatal
- 'error'
+ "error"
when :warn
- 'warning'
+ "warning"
else
- 'info'
+ "info"
end
end
end
end
end