Method: Command::Update#save_log

Defined in:
lib/command/update.rb

#save_log(log) ⇒ Object



126
127
128
129
130
131
132
133
134
135
136
# File 'lib/command/update.rb', line 126

def save_log(log)
  return unless @options["logging"]
  create_log_dir
  now = Time.now
  logname = File.join(log_dirname, LOG_FILENAME_FORMAT % now.strftime("%Y%m%d_%H%M%S"))
  File.open(logname, "w:UTF-8") do |fp|
    fp.puts "--- ログ出力日時 #{now.strftime("%Y/%m/%d %H:%M:%S")} ---"
    fp.puts log
  end
  remove_old_log
end