lib/gemirro/configuration.rb in gemirro-0.13.2 vs lib/gemirro/configuration.rb in gemirro-0.13.3
- old
+ new
@@ -22,16 +22,37 @@
#
class Configuration < Confstruct::Configuration
attr_reader :mirror_gems_directory, :mirror_gemspecs_directory
attr_accessor :source, :ignored_gems, :logger
+ LOGGER_LEVEL = {
+ 'debug' => Logger::DEBUG,
+ 'warning' => Logger::WARN,
+ 'info' => Logger::INFO,
+ 'unknown' => Logger::UNKNOWN,
+ 'error' => Logger::ERROR,
+ 'fatal' => Logger::FATAL
+ }
+
##
# Returns the logger
#
# @return [Logger]
#
def logger
@logger ||= Logger.new(STDOUT)
+ end
+
+ ##
+ # Set log level
+ #
+ # @param [string]
+ #
+ # @return [Logger]
+ #
+ def logger_level=(level)
+ logger.level = LOGGER_LEVEL[level] if LOGGER_LEVEL.key?(level)
+ logger
end
##
# Returns the template path to init directory
#