Sha256: a0a184e526e642dc31d50e8aae4d4ea7b940d5582772ff7b1185f9ea6bd6898a
Contents?: true
Size: 699 Bytes
Versions: 3
Compression:
Stored size: 699 Bytes
Contents
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
Version data entries
3 entries across 3 versions & 1 rubygems