Sha256: a3b59b305647f57de072a43e6823478f402d5bc6ed1824282859de978af0e200
Contents?: true
Size: 555 Bytes
Versions: 8
Compression:
Stored size: 555 Bytes
Contents
require 'logger' module Logging def logger @logger ||= Logging.logger_for(self.class.name) end # Use a hash class-ivar to cache a unique Logger per class: @loggers = {} class << self def logger_for(classname) @loggers[classname] ||= configure_logger_for(classname) end def configure_logger_for(classname) logger = Logger.new(STDOUT) logger.progname = classname logger.formatter = proc { |severity, datetime, progname, msg| "[#{severity}] #{progname}: #{msg}\n"} logger end end end
Version data entries
8 entries across 8 versions & 1 rubygems