Class: Logfoo::Hutch::ErrorHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/logfoo/integrations/hutch.rb

Constant Summary collapse

ID =
'Hutch'.freeze

Class Attribute Summary collapse

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeErrorHandler

Returns a new instance of ErrorHandler.



12
13
14
15
16
# File 'lib/logfoo/integrations/hutch.rb', line 12

def initialize
  @hutch_log = Logfoo.get_logger(ID)
  @bunny_log = Logfoo.get_logger('Bunny')
  @bunny_log.level = Logfoo::WARN
end

Class Attribute Details

.handlerObject

Returns the value of attribute handler.



7
8
9
# File 'lib/logfoo/integrations/hutch.rb', line 7

def handler
  @handler
end

Instance Attribute Details

#bunny_logObject (readonly)

Returns the value of attribute bunny_log.



4
5
6
# File 'lib/logfoo/integrations/hutch.rb', line 4

def bunny_log
  @bunny_log
end

#hutch_logObject (readonly)

Returns the value of attribute hutch_log.



4
5
6
# File 'lib/logfoo/integrations/hutch.rb', line 4

def hutch_log
  @hutch_log
end

Instance Method Details

#handle(message_id, payload, consumer, ex) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/logfoo/integrations/hutch.rb', line 18

def handle(message_id, payload, consumer, ex)
  line = ErrLine.build(
    logger_name: ID,
    exception:   ex,
    payload:     (payload || {}).merge!(
      consumer:    consumer,
      message_id:  message_id
    )
  )
  App.instance.append(line)
end