lib/itamae-mitsurin/mitsurin/task_base.rb in itamae-mitsurin-0.46 vs lib/itamae-mitsurin/mitsurin/task_base.rb in itamae-mitsurin-0.47
- old
+ new
@@ -1,8 +1,9 @@
require 'json'
require 'highline'
-require "tmpdir"
+require 'tmpdir'
+require 'logger'
module ItamaeMitsurin
module Mitsurin
module TaskBase
@@ -79,9 +80,19 @@
HighLine.new
end
def handler_logger
default = {"handlers"=>[{"type"=>"json", "path"=>"itamae-log.json"}]}
+ end
+
+ def file_logger
+ file_logger = ::Logger.new('logs/itamae.log', 5, 100 * 1024 * 1024).tap do |l|
+ l.formatter = proc do |serverity, datetime, progname, msg|
+ "#{datetime.strftime('%Y %m %d %H:%M:%S %z')} #{serverity} : #{msg}\n"
+ end
+ end
+
+ file_logger
end
end
end
end