Reputation: 11
I am currently working on eggplant functional and need your support in order to create a text file and append it whenever there is any action performed in the script. I will be using this text file for logging step by step results. can you please help ?
Upvotes: 0
Views: 1904
Reputation: 1
return
and the other options (linefeed, etc.
) don't work for me. The only way to get a new line is with crlf
(Carriage Return and Line Feed).
I'm using Windows 10.
Put:
dataLine & crlf
After:
file fullPath
Upvotes: 0
Reputation: 41
To append information to a log file, just do this:
put "this is a new log entry" & return after file "/path/to/log/file"
If the file doesn't exist, it will be created. After that, a new line will be added each time.
If you'll be doing this a lot you may want to create a custom handler that you can call. This one puts the date and time before each log entry:
to logEvent theEvent
put the abbreviated international time & tab & theEvent & return after file "/path/to/log/file"
end logEvent
Then call it like this:
logEvent "Interesting stuff happened."
Upvotes: 2