Sha256: 3b89f699a524fffcac5742220ad96c07427d815009ba4d7d28c814e2bcc3c561
Contents?: true
Size: 949 Bytes
Versions: 9
Compression:
Stored size: 949 Bytes
Contents
module Prefab class InternalLogger < SemanticLogger::Logger def initialize(klass) super(klass, :warn) instances << self end def log(log, message = nil, progname = nil, &block) return if recurse_check[local_log_id] recurse_check[local_log_id] = true begin super(log, message, progname, &block) ensure recurse_check[local_log_id] = false end end def local_log_id Thread.current.__id__ end # Our client outputs debug logging, # but if you aren't using Prefab logging this could be too chatty. # If you aren't using prefab log filter, only log warn level and above def self.using_prefab_log_filter! @@instances.each do |l| l.level = :trace end end private def instances @@instances ||= [] end def recurse_check @recurse_check ||=Concurrent::Map.new(initial_capacity: 2) end end end
Version data entries
9 entries across 9 versions & 1 rubygems