Module: SmartMachine::Logger

Included in:
Base
Defined in:
lib/smart_machine/logger.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.configure_logger_for(classname) ⇒ Object



27
28
29
30
31
32
# File 'lib/smart_machine/logger.rb', line 27

def configure_logger_for(classname)
  logger = ::Logger.new($stdout)
  logger.level = ::Logger.const_get("#{SmartMachine.config.logger_level}".upcase)
  logger.progname = classname
  logger
end

.included(base) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/smart_machine/logger.rb', line 14

def self.included(base)
  class << base
    def logger
      @logger ||= SmartMachine::Logger.logger_for(self.name)
    end
  end
end

.logger_for(classname) ⇒ Object



23
24
25
# File 'lib/smart_machine/logger.rb', line 23

def logger_for(classname)
  @loggers[classname] ||= configure_logger_for(classname)
end

Instance Method Details

#loggerObject



7
8
9
# File 'lib/smart_machine/logger.rb', line 7

def logger
  @logger ||= SmartMachine::Logger.logger_for(self.class.name)
end