Class: Hubbado::Log::NotifyRollbar
- Inherits:
-
LogHandler
- Object
- LogHandler
- Hubbado::Log::NotifyRollbar
- Defined in:
- lib/hubbado/log/notify_rollbar.rb
Overview
Forwards a log line worth an incident to Rollbar.
Constant Summary collapse
- LEVELS =
Rollbar's own levels. It has none above error, so the two severities above
warnshare it, and anything below a warning is running commentary that reaches the handlers which print rather than this one. { warn: :warn, error: :error, fatal: :error, unknown: :error }.freeze
Instance Method Summary collapse
-
#initialize(notifier: nil) ⇒ NotifyRollbar
constructor
A new instance of NotifyRollbar.
- #log(subject, severity, message, data = nil, stacktrace = nil) ⇒ Object
Constructor Details
#initialize(notifier: nil) ⇒ NotifyRollbar
Returns a new instance of NotifyRollbar.
14 15 16 17 18 |
# File 'lib/hubbado/log/notify_rollbar.rb', line 14 def initialize(notifier: nil) super() @notifier = notifier end |
Instance Method Details
#log(subject, severity, message, data = nil, stacktrace = nil) ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/hubbado/log/notify_rollbar.rb', line 20 def log(subject, severity, , data = nil, stacktrace = nil) level = LEVELS[severity.to_sym] return if level.nil? error = data if data.is_a?(::Exception) notifier.public_send( level, *[error, title(), extra(subject, data, stacktrace)].compact ) end |