Sha256: 8897b370e78d9f03ce3cc5e8d3ef10f132ef2314bd62ac5eb0f330c258c80aa4

Contents?: true

Size: 580 Bytes

Versions: 4

Compression:

Stored size: 580 Bytes

Contents

module Loggable
  
  module ClassMethods
    
    @@logger = nil
    
    # Use this method on any of your classes to trigger the logging facility:
    #
    #   MyClass.logger = Logger.new('/path/to/logfile')
    #
    # Now you can call the 'logger' method inside a class or instance method to log at
    # the specified level.  See the README for details.
    #
    def logger=(logger)
      @@logger = logger
    end
    
    def logger
      @@logger || LoggerStub.new
    end
    
  end
  
  module InstanceMethods
    def logger
      self.class.logger
    end
  end
  
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
vigetlabs-loggable-0.2.0 lib/loggable/log_methods.rb
vigetlabs-loggable-0.3.0 lib/loggable/log_methods.rb
loggable-0.2.0 lib/loggable/log_methods.rb
loggable-0.3.0 lib/loggable/log_methods.rb