Class: Module

Inherits:
Object show all
Defined in:
lib/safis/logging/automagic.rb

Instance Method Summary collapse

Instance Method Details

#logObject

Returns the Log for this Module (or Class)



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/safis/logging/automagic.rb', line 26

def log
  if ( not instance_variable_defined? :@log ) then
    # If we're Object, we're top 'o the chain and want to send our events to the default formatter
    parent = nil
    if ( self != Object ) then
      scope_position = name.rindex('::')
      parent_constant = (scope_position) ? eval(name[0...scope_position]) : Object
      
      parent = parent_constant.log
    end
    
    @log = Safis::Logging::Log.new(name, parent)
  end
  
  @log
end