Class: LunaPark::Notifiers::Bugsnag
- Inherits:
-
Object
- Object
- LunaPark::Notifiers::Bugsnag
- Includes:
- Extensions::SeverityLevels
- Defined in:
- lib/luna_park/notifiers/bugsnag.rb
Constant Summary
Constants included from Extensions::SeverityLevels
Extensions::SeverityLevels::LEVELS
Instance Method Summary collapse
-
#initialize(min_lvl: :debug) ⇒ Bugsnag
constructor
A new instance of Bugsnag.
-
#post(msg, lvl: :error, **details) ⇒ Object
rubocop:disable Metrics/MethodLength.
Methods included from Extensions::SeverityLevels
#debug, #error, #fatal, #info, #min_lvl, #min_lvl=, #unknown, #warning
Constructor Details
#initialize(min_lvl: :debug) ⇒ Bugsnag
Returns a new instance of Bugsnag.
11 12 13 |
# File 'lib/luna_park/notifiers/bugsnag.rb', line 11 def initialize(min_lvl: :debug) self.min_lvl = min_lvl end |
Instance Method Details
#post(msg, lvl: :error, **details) ⇒ Object
rubocop:disable Metrics/MethodLength
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/luna_park/notifiers/bugsnag.rb', line 15 def post(msg, lvl: :error, **details) # rubocop:disable Metrics/MethodLength raise ArgumentError, "Undefined severity level `#{lvl}`" unless LEVELS.include? lvl = wrap msg details = extend details, with: msg ::Bugsnag.notify() do |report| report.add_tab(:details, details) if %i[fatal unknown].include? lvl report.add_tab(:original_message_severity, lvl) report.severity = :error else report.severity = lvl end end end |