Class: Airbrake::NoticeNotifier
- Inherits:
-
Object
- Object
- Airbrake::NoticeNotifier
show all
- Includes:
- Inspectable, Loggable
- Defined in:
- lib/airbrake-ruby/notice_notifier.rb
Overview
NoticeNotifier is reponsible for sending notices to Airbrake. It supports synchronous and asynchronous delivery.
Constant Summary
collapse
- DEFAULT_FILTERS =
Returns filters to be executed first.
[
Airbrake::Filters::SystemExitFilter,
Airbrake::Filters::GemRootFilter,
].freeze
Constants included
from Inspectable
Inspectable::INSPECT_TEMPLATE
Instance Method Summary
collapse
Methods included from Loggable
#logger
#inspect, #pretty_print
Constructor Details
Returns a new instance of NoticeNotifier.
Instance Method Details
#add_filter(filter = nil, &block) ⇒ Object
44
45
46
|
# File 'lib/airbrake-ruby/notice_notifier.rb', line 44
def add_filter(filter = nil, &block)
@filter_chain.add_filter(block_given? ? block : filter)
end
|
#build_notice(exception, params = {}) ⇒ Object
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
# File 'lib/airbrake-ruby/notice_notifier.rb', line 54
def build_notice(exception, params = {})
if @async_sender.closed?
raise Airbrake::Error,
"Airbrake is closed; can't build exception: " \
"#{exception.class}: #{exception}"
end
if exception.is_a?(Airbrake::Notice)
exception[:params].merge!(params)
exception
else
Notice.new(convert_to_exception(exception), params.dup)
end
end
|
#close ⇒ Object
70
71
72
73
|
# File 'lib/airbrake-ruby/notice_notifier.rb', line 70
def close
@sync_sender.close
@async_sender.close
end
|
76
77
78
|
# File 'lib/airbrake-ruby/notice_notifier.rb', line 76
def configured?
@config.valid?
end
|
#delete_filter(filter_class) ⇒ Object
49
50
51
|
# File 'lib/airbrake-ruby/notice_notifier.rb', line 49
def delete_filter(filter_class)
@filter_chain.delete_filter(filter_class)
end
|
#has_filter?(filter_class) ⇒ Boolean
87
88
89
|
# File 'lib/airbrake-ruby/notice_notifier.rb', line 87
def has_filter?(filter_class) @filter_chain.includes?(filter_class)
end
|
#merge_context(context) ⇒ Object
#notify(exception, params = {}, &block) ⇒ Object
34
35
36
|
# File 'lib/airbrake-ruby/notice_notifier.rb', line 34
def notify(exception, params = {}, &block)
send_notice(exception, params, default_sender, &block)
end
|
#notify_sync(exception, params = {}, &block) ⇒ Object
39
40
41
|
# File 'lib/airbrake-ruby/notice_notifier.rb', line 39
def notify_sync(exception, params = {}, &block)
send_notice(exception, params, @sync_sender, &block).value
end
|