lib/review/epubmaker.rb in review-3.0.0.preview1 vs lib/review/epubmaker.rb in review-3.0.0.preview2
- old
+ new
@@ -43,14 +43,12 @@
def warn(msg)
@logger.warn "#{File.basename($PROGRAM_NAME, '.*')}: #{msg}"
end
- def log(s)
- if @config['debug'].present?
- puts s
- end
+ def log(msg)
+ @logger.debug(msg)
end
def load_yaml(yamlfile)
loader = ReVIEW::YAMLLoader.new
@config = ReVIEW::Configure.values
@@ -62,9 +60,18 @@
@producer = Producer.new(@config)
@producer.load(yamlfile)
@config = @producer.config
@config.maker = 'epubmaker'
+ update_log_level
+ end
+
+ def update_log_level
+ if @config['debug']
+ @logger.level = Logger::DEBUG
+ else
+ @logger.level = Logger::INFO
+ end
end
def build_path
if @config['debug']
path = File.expand_path("#{@config['bookname']}-epub", Dir.pwd)