Class: Prefab::InternalLogger

Inherits:
SemanticLogger::Logger
  • Object
show all
Defined in:
lib/prefab/internal_logger.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass) ⇒ InternalLogger

Returns a new instance of InternalLogger.



4
5
6
7
# File 'lib/prefab/internal_logger.rb', line 4

def initialize(klass)
  super(klass, :warn)
  instances << self
end

Class Method Details

.using_prefab_log_filter!Object

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



26
27
28
29
30
# File 'lib/prefab/internal_logger.rb', line 26

def self.using_prefab_log_filter!
  @@instances.each do |l|
    l.level = :trace
  end
end

Instance Method Details

#local_log_idObject



19
20
21
# File 'lib/prefab/internal_logger.rb', line 19

def local_log_id
  Thread.current.__id__
end

#log(log, message = nil, progname = nil, &block) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/prefab/internal_logger.rb', line 9

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