Log file

How do I log the user inputs from my program to a text file? I’ve looked
on the web for this, and I can’t find it…

Thanks!

Something like this?

File.open(“user_output.txt”, “w”) do |f|
while line = gets
f.puts line
end
end

(Sorry, couldn’t resist… ;])

gegroet,
Erik V. - http://www.erikveen.dds.nl/

A simple solution could be to use ‘simplelog’.

c:> gem search simplelog
simplelog (0.2.2)
The simplest logger ever. Just require ‘simplelog’ and all puts
statements are logged to .txt as well as shown on screen.

Meaning that whenever your program uses puts it’s shown on screen as
you’re used to, but it’s also logged to a logfile.

http://rubyforge.org/projects/backofficegems/

All the best