module Spyt::Loggable

Loggable Module: Include this into anything to provide logging capability.

Loggable Module

Public Class Methods

extended(base) click to toggle source
# File lib/spyt/loggable.rb, line 25
def self.extended base
        base.send(:define_method, :log) { base.log } if base.is_a? Class
end

Public Instance Methods

log() click to toggle source

Log: Logger Access @return [Logger] A Logger tailored to the containing object

# File lib/spyt/loggable.rb, line 21
def log
        @logger ||= Logger.new self.try(:name) || self.try(:class).try(:name) || self.to_s
end