Module: Loggable::ClassMethods

Included in:
Class, Module
Defined in:
lib/loggable/log_methods.rb

Constant Summary collapse

@@logger =
nil

Instance Method Summary collapse

Instance Method Details

#loggerObject



18
19
20
# File 'lib/loggable/log_methods.rb', line 18

def logger
  @@logger || LoggerStub.new
end

#logger=(logger) ⇒ Object

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.



14
15
16
# File 'lib/loggable/log_methods.rb', line 14

def logger=(logger)
  @@logger = logger
end