lib/sapience/error_handler/sentry.rb in sapience-2.4.0 vs lib/sapience/error_handler/sentry.rb in sapience-2.5.0
- old
+ new
@@ -1,5 +1,6 @@
+# frozen_string_literal: true
begin
require "sentry-raven"
rescue LoadError
raise 'Gem sentry-raven is required for logging purposes. Please add the gem "sentry-raven" to your Gemfile.'
end
@@ -7,15 +8,14 @@
# Send log messages to sentry
#
# Example:
# Sapience.add_appender(:stream, {io: STDOUT, formatter: :color})
#
-# rubocop:disable Style/ClassAndModuleChildren
module Sapience
class ErrorHandler
class Sentry < Sapience::ErrorHandler
- VALIDATION_MESSAGE = "DSN is not valid, please add appender with :dsn key or set SENTRY_DSN".freeze
+ VALIDATION_MESSAGE = "DSN is not valid, please add appender with :dsn key or set SENTRY_DSN"
URI_REGEXP = URI::DEFAULT_PARSER.regexp[:ABS_URI]
#
# level: [:trace | :debug | :info | :warn | :error | :fatal]
# Override the log level for this appender.
# Default: Sapience.config.default_level
@@ -50,11 +50,11 @@
end
def tags_context(options = {})
Raven.tags_context(options)
end
- alias_method :tags=, :tags_context
+ alias tags= tags_context
def configured?
@configured == true
end
@@ -116,10 +116,9 @@
end
def sentry_dsn
(@sentry_dsn || ENV["SENTRY_DSN"]).to_s
end
-
# Sapience logger
def sentry_logger
@sentry_logger ||= begin
logger = Sapience[self.class]