Class: LunaPark::Notifiers::Sentry
- Inherits:
-
Object
- Object
- LunaPark::Notifiers::Sentry
- Includes:
- Extensions::Injector, Extensions::SeverityLevels
- Defined in:
- lib/luna_park/notifiers/sentry.rb
Constant Summary
Constants included from Extensions::SeverityLevels
Extensions::SeverityLevels::LEVELS
Instance Method Summary collapse
-
#initialize(min_lvl: :debug) ⇒ Sentry
constructor
A new instance of Sentry.
- #post(msg, lvl: :error, **details) ⇒ Object
Methods included from Extensions::SeverityLevels
#debug, #error, #fatal, #info, #min_lvl, #min_lvl=, #unknown, #warning
Methods included from Extensions::Injector
Methods included from Extensions::Injector::InstanceMethods
#dependencies, #dependencies=, #inject
Methods included from Extensions::Injector::ClassMethods
#dependencies, #dependency, #inherited
Constructor Details
#initialize(min_lvl: :debug) ⇒ Sentry
Returns a new instance of Sentry.
15 16 17 |
# File 'lib/luna_park/notifiers/sentry.rb', line 15 def initialize(min_lvl: :debug) self.min_lvl = min_lvl end |
Instance Method Details
#post(msg, lvl: :error, **details) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/luna_park/notifiers/sentry.rb', line 19 def post(msg, lvl: :error, **details) raise ArgumentError, "Undefined severity level `#{lvl}`" unless LEVELS.include? lvl = wrap msg details = extend details, with: msg if .is_a?(Exception) driver.capture_exception(, extra: details, level: lvl) else driver.(, extra: details, level: lvl) end end |