By chance there was this same conversation going on over on the newsgroups. Over there, in order to avoid using the ASCII driver I had suggested a simple function using StringTheory along these lines:
Logit procedure(String pMessage, String pFileName, long pAppend=true, long pODS=true)
st stringTheory
code
st.setvalue(pMessage,st:clip)
if pODS then st.trace(). ! outputs to ODS
if not st.EndsWith('<13,10>') then st.append('<13,10>').
if not st.saveFile(pFileName, pAppend)
message('unable to write to file ' & clip(pFileName) & |
'||Error: ' & st.LastError)
end