29-Aug-10
This simple UDF allows you to create a text log files with the following format. Using a very simple (see example). Enjoy!
###Event Log Files UDF Exaple### 2010-08-29 20:26:44 (0006) Program start 2010-08-29 20:26:44 (0008) Pinging www.autoitscript.com... 2010-08-29 20:26:44 (0005) Ping is successful, Time = 73 ms 2010-08-29 20:26:44 (0007) Program exit 2010-08-29 20:26:44 (0006) Program start 2010-08-29 20:26:44 (0008) Pinging www.autoitscript.com... 2010-08-29 20:26:44 (0005) Ping is successful, Time = 110 ms 2010-08-29 20:26:44 (0007) Program exit 2010-08-29 20:26:45 (0006) Program start 2010-08-29 20:26:45 (0008) Pinging www.autoitscript.com... 2010-08-29 20:26:45 (0005) Ping is successful, Time = 154 ms 2010-08-29 20:26:45 (0007) Program exit
Log UDF Library v1.0
Log.au3 11.02K
679 downloadsExample
#Include <Log.au3> Opt('MustDeclareVars', 1) Global $hLog, $Time $hLog = _Log_Open(@ScriptDir & '\MyProg.log', '###Event Log Files UDF Exaple###') _Log_Report($hLog, 'Program start', 6) _Log_Report($hLog, 'Pinging www.autoitscript.com...', 8) $Time = Ping('www.autoitscript.com') If $Time Then _Log_Report($hLog, 'Ping is successful, Time = ' & $Time & ' ms', 5) Else Switch @error Case 1 _Log_Report($hLog, 'Ping is fails, host is offline', 1) Case 2 _Log_Report($hLog, 'Ping is fails, host is unreachable', 2) Case 3 _Log_Report($hLog, 'Ping is fails, bad destination', 3) Case Else _Log_Report($hLog, 'Ping is fails, unknown error', 4) EndSwitch EndIf _Log_Report($hLog, 'Program exit', 7) _Log_Close($hLog)
Edited by Yashied, 29 August 2010 - 07:53 PM.






