Class: Newshound::ExceptionReporter
- Inherits:
-
Object
- Object
- Newshound::ExceptionReporter
- Defined in:
- lib/newshound/exception_reporter.rb
Instance Attribute Summary collapse
-
#configuration ⇒ Object
readonly
Returns the value of attribute configuration.
-
#exception_source ⇒ Object
readonly
Returns the value of attribute exception_source.
-
#time_range ⇒ Object
readonly
Returns the value of attribute time_range.
Instance Method Summary collapse
- #generate_report ⇒ Object
-
#initialize(exception_source: nil, configuration: nil, time_range: 24.hours) ⇒ ExceptionReporter
constructor
A new instance of ExceptionReporter.
Constructor Details
#initialize(exception_source: nil, configuration: nil, time_range: 24.hours) ⇒ ExceptionReporter
Returns a new instance of ExceptionReporter.
7 8 9 10 11 |
# File 'lib/newshound/exception_reporter.rb', line 7 def initialize(exception_source: nil, configuration: nil, time_range: 24.hours) @exception_source = exception_source || (defined?(ExceptionTrack::Log) ? ExceptionTrack::Log : nil) @configuration = configuration || Newshound.configuration @time_range = time_range end |
Instance Attribute Details
#configuration ⇒ Object (readonly)
Returns the value of attribute configuration.
5 6 7 |
# File 'lib/newshound/exception_reporter.rb', line 5 def configuration @configuration end |
#exception_source ⇒ Object (readonly)
Returns the value of attribute exception_source.
5 6 7 |
# File 'lib/newshound/exception_reporter.rb', line 5 def exception_source @exception_source end |
#time_range ⇒ Object (readonly)
Returns the value of attribute time_range.
5 6 7 |
# File 'lib/newshound/exception_reporter.rb', line 5 def time_range @time_range end |
Instance Method Details
#generate_report ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/newshound/exception_reporter.rb', line 13 def generate_report return no_exceptions_block if recent_exceptions.empty? [ { type: "section", text: { type: "mrkdwn", text: "*🚨 Recent Exceptions (Last 24 Hours)*" } }, *format_exceptions ] end |