Module: Spyt::Loggable

Defined in:
lib/spyt/loggable.rb,
lib/spyt/loggable/logger.rb

Overview

Loggable Module

Defined Under Namespace

Classes: Logger

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



25
26
27
# File 'lib/spyt/loggable.rb', line 25

def self.extended base
	base.send(:define_method, :log) { base.log } if base.is_a? Class
end

Instance Method Details

#logLogger

Log: Logger Access

Returns:

  • (Logger)

    A Logger tailored to the containing object



21
22
23
# File 'lib/spyt/loggable.rb', line 21

def log
	@logger ||= Logger.new self.try(:name) || self.try(:class).try(:name) || self.to_s
end