ERROROUT Error reporting function


FUNCTION errorout AS C (errormsg AS C = "", severity AS N = 0 )

       

       fldr = "\a5\logs"

       logfile = fldr + "\sql_error.log"

       if file.exists(fldr) = .f.

               file.dir_create_recurse(fldr)

       end if

       vErrorMsg = time("yyyy/MM/dd 0h:0m:0s") + "|" + ErrorMsg + crlf() + replicate("-",10) + crlf()

       file.append_line(logfile,vErrorMsg)        

       if severity > 4

'                email_send("YOUR EMAIL ADDRESS", "A5 Website Error",vErrorMsg)

'                put what you want to do if the error is critical

       end if


END FUNCTION