Here is one way...

WriteLog2() - Writes to a specified log file with optional TimeStamp
http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=83049#Post83049

How to use UDFs -
http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=81943#Post81943

The rest of the UDFs are here -
http://www.kixtart.org/forums/ubbthreads.php?ubb=postlist&Board=7&page=1