Class: AxialNotifier::Sender
- Inherits:
-
Object
- Object
- AxialNotifier::Sender
- Defined in:
- lib/axial_notifier/sender.rb
Instance Method Summary collapse
-
#initialize(configuration) ⇒ Sender
constructor
A new instance of Sender.
- #log(exception) ⇒ Object
- #parse(exception) ⇒ Object
Constructor Details
#initialize(configuration) ⇒ Sender
Returns a new instance of Sender.
3 4 5 6 |
# File 'lib/axial_notifier/sender.rb', line 3 def initialize(configuration) @config = configuration @syslog = Syslog.open(@config.api_key, nil, @config.facility) end |
Instance Method Details
#log(exception) ⇒ Object
8 9 10 |
# File 'lib/axial_notifier/sender.rb', line 8 def log(exception) @syslog.err parse(exception) end |
#parse(exception) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/axial_notifier/sender.rb', line 12 def parse(exception) if exception.is_a?(String) {:message => exception}.to_json else { :environment => (@config.environment), :exception => exception.class, :message => exception., :backtrace => exception.backtrace.join('\n') }.to_json end end |