Sha256: 497c76f43f9a525f59260be1ae59ce0293f4d7bb5acff30aa885d4b1181d08ac

Contents?: true

Size: 441 Bytes

Versions: 140

Compression:

Stored size: 441 Bytes

Contents

# frozen_string_literal: true

require "logger"
require "set"

# Subclass of logger with method to only log a warning once
# prevents the log from filling up with repeated messages.
module Appsignal
  class Logger < ::Logger
    def seen_keys
      @seen_keys ||= Set.new
    end

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

Version data entries

140 entries across 140 versions & 1 rubygems

Version Path
appsignal-3.1.6-java lib/appsignal/logger.rb
appsignal-3.1.6 lib/appsignal/logger.rb
appsignal-3.1.5-java lib/appsignal/logger.rb
appsignal-3.1.5 lib/appsignal/logger.rb
appsignal-3.1.4-java lib/appsignal/logger.rb
appsignal-3.1.4 lib/appsignal/logger.rb
appsignal-3.1.3-java lib/appsignal/logger.rb
appsignal-3.1.3 lib/appsignal/logger.rb
appsignal-3.1.2-java lib/appsignal/logger.rb
appsignal-3.1.2 lib/appsignal/logger.rb
appsignal-3.1.1-java lib/appsignal/logger.rb
appsignal-3.1.1 lib/appsignal/logger.rb
appsignal-3.1.0-java lib/appsignal/logger.rb
appsignal-3.1.0 lib/appsignal/logger.rb
appsignal-3.0.27-java lib/appsignal/logger.rb
appsignal-3.0.27 lib/appsignal/logger.rb
appsignal-3.0.26-java lib/appsignal/logger.rb
appsignal-3.0.26 lib/appsignal/logger.rb
appsignal-3.0.25-java lib/appsignal/logger.rb
appsignal-3.0.25 lib/appsignal/logger.rb