Class: Appsignal::Utils::IntegrationLogger

Inherits:
Logger
  • Object
show all
Defined in:
lib/appsignal/utils/integration_logger.rb

Overview

Subclass of logger with method to only log a warning once prevents the local log from filling up with repeated messages.

Instance Method Summary collapse

Instance Method Details

#seen_keysObject



6
7
8
# File 'lib/appsignal/utils/integration_logger.rb', line 6

def seen_keys
  @seen_keys ||= Set.new
end

#warn_once_then_debug(key, message) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/appsignal/utils/integration_logger.rb', line 10

def warn_once_then_debug(key, message)
  if !seen_keys.add?(key).nil?
    warn message
  else
    debug message
  end
end