lib/simple_deploy/logger.rb in simple_deploy-0.3.5 vs lib/simple_deploy/logger.rb in simple_deploy-0.3.6

- old
+ new

@@ -1,17 +1,28 @@ module SimpleDeploy class SimpleDeployLogger def initialize(args = {}) @logger = args[:logger] ||= Logger.new(STDOUT) + @log_level = args[:log_level] ||= 'info' unless args[:logger] @logger.datetime_format = "%Y-%m-%d %H:%M:%S" @logger.formatter = proc do |severity, datetime, progname, msg| "#{datetime}: #{msg}\n" end end + case @log_level.downcase + when 'info' + @logger.level = Logger::INFO + when 'debug' + @logger.level = Logger::DEBUG + when 'warn' + @logger.level = Logger::WARN + when 'error' + @logger.level = Logger::ERROR + end @logger end def debug(msg) @logger.debug msg