The Formula Engine function text_write allows you to write to text files. You can use this for example to add logging messages into your FE code:
acdba@acbox:~$ cat test.fe
function logMsg(msg) {
text_write(">>fe.log", str(datetime(,'MSEC'))+': '+msg);
}
function myFunc() {
logMsg('Start.');
// do something
logMsg('End.');
}
myFunc();
acdba@acbox:~$ ac_evalform -f test.fe
1
acdba@acbox:~$ cat $AC_WORKDIR/fe.log
20190323:145724:518: Start.
20190323:145724:518: End.
acdba@acbox:~$
As you can see, the default path for files written in this way is $AC_WORKDIR
. Also, note the use
of datetime to prepend a timestamp to each log message.