Module: ObjectLogging::InstanceMethods

Defined in:
lib/object_logging.rb

Instance Method Summary collapse

Instance Method Details

#loggerObject



50
51
52
53
54
55
56
57
# File 'lib/object_logging.rb', line 50

def logger
  @logger ||= Logger.new(self)
  
  # User could have assigned a logger other than ObjectLogging::Logger to this object.
  @logger.objectify(self) if @logger.instance_of?(ObjectLogging::Logger) # Hence the guard.
  
  @logger
end

#logger=(logger) ⇒ Object



59
60
61
# File 'lib/object_logging.rb', line 59

def logger=(logger)
  @logger = logger
end

#object_loggingObject



42
43
44
45
46
47
48
# File 'lib/object_logging.rb', line 42

def object_logging
  if instance_of?(Class)
    self.metaclass.object_logging
  else
    self.class.object_logging
  end
end