12-29-2004, 06:07 AM
I wish I knew enough to edit "LogFile" (a 2.1.4beta extension function) to make a version that writes multi-session log files. In other words, I don't want the modified version to rename existing log file when first used in a session. FYI, here is the unmodified LogFile code:
Especially nice would be if the modified function had a third argument [maxlength] so it could remove top lines from log files longer than maxlength.
/
function ~s [logdatetime] ;;Writes/appends s to file "qm log.txt"
Appends string s to "qm log.txt" file in QM folder.
To use other log file, store path into global
str variable _logfile. First time in session,
existing log file is renamed to "qm log prev.txt".
File-- f
if(!f.m_file)
str path.expandpath(_logfile)
if(getenv("qmlog")) f.Open(path "a")
else
if(dir(path))
str ppath.from(_qmdir "qm log prev.txt")
ren- path ppath 0x2C0|FOF_NOERRORUI|FOF_SILENT~FOF_ALLOWUNDO; err
f.Open(path "w")
_putenv("qmlog=1")
if(logdatetime) s-_s.time("%c[]")
f.WriteLine(s)
err+ end ES_FAILED