Appfuel::Initialize.define('global.logging') do |config, container| logfile = config[:logfile] || 'stdout' logger_file = ->(file) { file = file.to_s if file.empty? || file.downcase == 'stdout' file = $stdout elsif file.downcase == 'stderr' file = $stderr else file end } factory = ->(file, level = 'info', file_coercer = logger_file) { logger = Logger.new(file_coercer.call(file)) if level logger.level = Logger.const_get(level.to_s.upcase) end logger.formatter = Sneakers::Support::ProductionFormatter logger } container.register(:logger, factory.call(logfile)) container.register(:logger_factory, factory) nil end