49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# File 'lib/trellis/logging.rb', line 49
def Logging.included(recipient)
cfg = YamlConfigurator
cfg['HOME'] = '.'
begin
cfg.load_yaml_file('logging.yaml') logger = Logger['trellis']
rescue
logger = Logger.new 'trellis'
formatter = PatternFormatter.new(:pattern => '%d %l: %m ', :date_pattern => '%y%m%d %H:%M:%S')
logger.add Log4r::StdoutOutputter.new('stdout', :formatter=> formatter)
end
logger.level = INFO
recipient.instance_variable_set(:@logger, logger)
recipient.class.send(:define_method, :logger) { @logger }
end
|