class Bricolage::StreamingLoad::AlertingLogger

Public Class Methods

new(logger:, sns_datasource:, alert_level: 'warn') click to toggle source
# File lib/bricolage/streamingload/alertinglogger.rb, line 10
def initialize(logger:, sns_datasource:, alert_level: 'warn')
  @logger = logger
  @alerter = Bricolage::Logger.new(device: sns_datasource)
  @alerter.level = ::Logger.const_get(alert_level.upcase)
end

Public Instance Methods

exception(ex) click to toggle source
# File lib/bricolage/streamingload/alertinglogger.rb, line 29
def exception(ex)
  @logger.exception(ex)
  begin
    @alerter.error(ex.message)
  rescue Exception => err
    @logger.error "could not send alert: #{err.message}"
  end
end