lib/sapience/appender/sentry.rb in sapience-1.0.1 vs lib/sapience/appender/sentry.rb in sapience-1.0.2
- old
+ new
@@ -33,35 +33,35 @@
#
# host: [String]
# Name of this host to appear in log messages.
# Default: Sapience.config.host
#
- # application: [String]
+ # app_name: [String]
# Name of this application to appear in log messages.
- # Default: Sapience.config.application
+ # Default: Sapience.app_name
def initialize(options = {}, &block)
validate_options!(options)
options[:level] ||= :error
Raven.configure do |config|
config.dsn = options.delete(:dsn)
config.tags = { environment: Sapience.environment }
end
-
super(options, &block)
end
def validate_options!(options = {})
fail ArgumentError, "Options should be a Hash" unless options.is_a?(Hash)
dsn_valid = options[:dsn].to_s =~ URI::DEFAULT_PARSER.regexp[:ABS_URI]
fail ArgumentError, "The :dsn key (#{options[:dsn]}) is not a valid URI" unless dsn_valid
end
# Send an error notification to sentry
- def log(log)
+ def log(log) # rubocop:disable AbcSize
return false unless should_log?(log)
context = formatter.call(log, self)
+
if log.exception
context.delete(:exception)
Raven.capture_exception(log.exception, context)
else
message = {