Sha256: e186ba344fdf973a94d81e2d9369e545929c5142c5fde3159fa14f5b392deb54
Contents?: true
Size: 985 Bytes
Versions: 2
Compression:
Stored size: 985 Bytes
Contents
require 'r10k' require 'log4r' require 'log4r/configurator' module R10K::Logging include Log4r def logger_name self.class.to_s end def logger unless @logger @logger = Log4r::Logger.new(self.logger_name) @logger.add R10K::Logging.outputter end @logger end class << self include Log4r def included(klass) unless @log4r_loaded Configurator.custom_levels(*%w{DEBUG2 DEBUG1 DEBUG INFO NOTICE WARN ERROR FATAL}) Logger.global.level = Log4r::ALL @log4r_loaded = true end end def level @level || Log4r::WARN # Default level is WARN end def level=(val) outputter.level = val @level = val end def formatter @formatter ||= Log4r::PatternFormatter.new(:pattern => '[%C - %l] %m') end def outputter @outputter ||= Log4r::StderrOutputter.new('console', :level => self.level, :formatter => formatter ) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
r10k-1.0.0rc2 | lib/r10k/logging.rb |
r10k-1.0.0rc1 | lib/r10k/logging.rb |