Sha256: 5947d99373976ade5babc7e74bc338413357c2d0d3a76b5f3e2a9277eacbdf67
Contents?: true
Size: 785 Bytes
Versions: 10
Compression:
Stored size: 785 Bytes
Contents
require "logger" $stdout.sync = true module SmartMachine module Logger def logger @logger ||= SmartMachine::Logger.logger_for(self.class.name) end # Use a hash class-ivar to cache a unique Logger per class: @loggers = {} def self.included(base) class << base def logger @logger ||= SmartMachine::Logger.logger_for(self.name) end end end class << self def logger_for(classname) @loggers[classname] ||= configure_logger_for(classname) end def configure_logger_for(classname) logger = ::Logger.new($stdout) logger.level = ::Logger.const_get("#{SmartMachine.config.logger_level}".upcase) logger.progname = classname logger end end end end
Version data entries
10 entries across 10 versions & 1 rubygems