Here is some macro code that I use to log when data is exported, which you could adapt for your needs. It uses activedocument that obviously cannot be used in a script but you wont need to anyway - invoke your routine and pass it the details you want written to the log.
set fso = CreateObject("Scripting.FileSystemObject")
on error resume next
set logFile = fso.GetFile(vExportLog)
if err <> 0 then ' file does not exist on error goto 0 set logFile = fso.CreateTextFile(vExportLog) set logFile = fso.GetFile(vExportLog) else on error goto 0 end if
set txsStream = logFile.OpenAsTextStream(8) ' append txsStream.WriteLine Now & " " & vExportTo & " created by " & doc.GetProperties.FileName txsStream.Close