2013-06-24から1日間の記事一覧

スクリプトの時刻付きログ出力メソッド

log_pathにlog_textを出力。 なおMac OS Xでのローカルユーザのlogファイルは ~/Library/Logs/ に置かれます。 def log_with_time(log_path, log_text) open(File.expand_path(log_path), "a+") do |f| f.puts Time.now.strftime("%Y-%m-%d %H:%M:%S") + " "…