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-2.11.0.alpha.1 lib/appsignal/logger.rb
appsignal-2.11.0.alpha.1-java lib/appsignal/logger.rb
appsignal-2.10.9 lib/appsignal/logger.rb
appsignal-2.10.9-java lib/appsignal/logger.rb
appsignal-2.10.9.beta.1-java lib/appsignal/logger.rb
appsignal-2.10.9.beta.1 lib/appsignal/logger.rb
appsignal-2.10.8 lib/appsignal/logger.rb
appsignal-2.10.8-java lib/appsignal/logger.rb
appsignal-2.10.7-java lib/appsignal/logger.rb
appsignal-2.10.7 lib/appsignal/logger.rb
appsignal-2.10.6-java lib/appsignal/logger.rb
appsignal-2.10.6 lib/appsignal/logger.rb
appsignal-2.10.6.beta.1-java lib/appsignal/logger.rb
appsignal-2.10.6.beta.1 lib/appsignal/logger.rb
appsignal-2.10.5-java lib/appsignal/logger.rb
appsignal-2.10.5 lib/appsignal/logger.rb
appsignal-2.10.4 lib/appsignal/logger.rb
appsignal-2.10.4-java lib/appsignal/logger.rb
appsignal-2.10.3-java lib/appsignal/logger.rb
appsignal-2.10.3 lib/appsignal/logger.rb