LoginSignup
2
2

More than 5 years have passed since last update.

Rubymotion で p メソッドと NSLog メソッドの出力先を Console.app から任意のファイルに変更する

Posted at

p メソッドは stdout に
NSLog メソッドは stderr に吐き出しているだけらしい。

そして Rubymotion には stdout と stderr の出力先を指定するための環境変数が用意されています。

  • SIM_STDOUT_PATH
  • SIM_STDERR_PATH

なのでこんな感じの rake コマンドを叩くもよし

[bundle exec] rake SIM_STDOUT_PATH=/tmp/motion_stdout.log SIM_STDERR_PATH=/tmp/motion_stderr.log

Rakefile

Motion::Project::App.setup do |app|
    ・
    ・
  ENV["SIM_STDOUT_PATH"] = "/tmp/motion_stdout.log"
  ENV["SIM_STDERR_PATH"] = "/tmp/motion_stderr.log"
    ・
    ・
end

と記述するもよし。

活用例

例えばこんな感じに Jenkins の出力をいい感じにするのに使えるようです。おういえー。

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2