if his code is better, can someone (maybe Bryce) explain what his code is doing and why it is better? What is he doing with the $LogFile var by setting it equal to the three different files?? I can see the benefit to just putting @ERROR and @SERROR as the passed vars for the function but other than that, are the two functions serving the same purpose?
Code:
function ErrorLog($error,$serror,optional $ErrorMsg)
DIM $LogFile,$LogError,$AltLogFile,$error,$serror,$ErrorString
$ErrorString = "Error $error, $serror, $ErrorMsg, @WKSTA, @USERID, @DATE, @TIME, @CRLF"
$LogFile = "\\server\SoftwarePushes\sms\logging\@MDayNo_@MonthNo_@Year.log"
$AltLogFile = "\\server\SoftwarePushes\sms\logging\@MDayNo_@MonthNo_@Year-@WKSTA.log"
$LogError = OPEN (5,$LogFile,5)
If $LogError=0
$ = WRITELINE(5,$ErrorString)
Else
$ = OPEN (6,$AltLogFile,5)
$ = WRITELINE(6,$ErrorString)
$ = CLOSE (6)
EndIf
$ = CLOSE(5)
endfunction