Class: Hatchet::AirbrakeAppender
- Inherits:
-
Object
- Object
- Hatchet::AirbrakeAppender
- Includes:
- LevelManager
- Defined in:
- lib/hatchet_airbrake/airbrake_appender.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Public: The name to post the messages as (default: Hatchet).
Instance Method Summary collapse
-
#add(level, context, message) ⇒ Object
Internal: Sends an error to Airbrake.
-
#initialize {|_self| ... } ⇒ AirbrakeAppender
constructor
Public: Creates a new instance.
Constructor Details
#initialize {|_self| ... } ⇒ AirbrakeAppender
Public: Creates a new instance.
By default the appender is created with a SimpleFormatter.
block - Optional block that can be used to customize the appender. The
appender itself is passed to the block.
16 17 18 19 |
# File 'lib/hatchet_airbrake/airbrake_appender.rb', line 16 def initialize @name = 'Hatchet-Airbrake' yield self if block_given? end |
Instance Attribute Details
#name ⇒ Object
Public: The name to post the messages as (default: Hatchet).
7 8 9 |
# File 'lib/hatchet_airbrake/airbrake_appender.rb', line 7 def name @name end |
Instance Method Details
#add(level, context, message) ⇒ Object
Internal: Sends an error to Airbrake.
level - The level of the message. context - The context of the message. message - The unformatted message.
Returns nothing.
29 30 31 32 33 34 35 36 37 |
# File 'lib/hatchet_airbrake/airbrake_appender.rb', line 29 def add(level, context, ) if .error opts = { :error_message => .to_s, :backtrace => .error.backtrace } ::Airbrake.notify .error, opts end end |