Is there a way to log the output of the Scala REPL in a file ?
6
-
Did you have a look at .scala_history? stackoverflow.com/questions/11561719/…– Malte SchwerhoffAug 8, 2012 at 20:03
-
@mhs Thank you, but .scala_history only saves the commands I typed, not the REPL output as a whole.– John ThreepwoodAug 8, 2012 at 20:07
-
My bad, I missed that part of your question.– Malte SchwerhoffAug 8, 2012 at 20:09
-
how about just hitting "save" in your terminal window?– dhgAug 8, 2012 at 20:15
-
According to stackoverflow.com/questions/9494014/… it is not possible with 2.9. Give it a try in 2.10.– Malte SchwerhoffAug 8, 2012 at 20:17
|
Show 1 more comment
1 Answer
You could import java.util.PrintWriter and have some code like this:
val out = new PrintWriter("out.txt")
out.println("output string")
out.flush();
out.close();
-
1