有没有写LOG日志的UDF
有没有写LOG日志的UDF?#include <EventLog.au3>
了解一下。 win系統LOG? 自訂義LOG? 用於哪邊? 自訂義LOG? 自定义软件的log生成。 本帖最后由 redapple2008 于 2018-9-13 09:56 编辑
这个是加载dll写系统日志的,我自定议log文件需要自己写文件生成吗?
#include "_CustomEventLog.au3"
$MyEventName = "AutoIt"
$EventLog = _SetLog($MyEventName,"AutoIteventmsg.dll")
If NOT @error then
_RegisterEvent($EventLog, $SUCCESS, $App_Started, @ScriptName)
_RegisterEvent($EventLog, $INFORMATION, $App_OK, "Just confirming this app is OK")
_RegisterEvent($EventLog, $ERROR, $App_Error, "This app is not feeling very well" & @crlf & "Can someone call a doctor")
_RegisterEvent($EventLog, $WARNING, $App_Warning, "There is no crap in this event log")
_RegisterEvent($EventLog, $INFORMATION, $App_Information, "Nothing to see here")
_RegisterEvent($EventLog, $INFORMATION, $App_Free, "This is my Free string" & @crlf & "with nothing at the begining")
_RegisterEvent($EventLog, $SUCCESS, $App_Stopped, @ScriptName)
EndIf
;or using the normal AutoIt includes
$EventLog = _SetLog($MyEventName,"AutoIteventmsg.dll")
Global $aData=
$hEventLog = _EventLog__RegisterSource("",$EventLog)
_EventLog__Report($hEventLog, $INFORMATION, "None", $App_Information, "","Another message without the crap", $aData)
_EventLog__Close ($hEventLog) 还有这个模块,我都是直接输出到文件。比如时间:事件 hualong1009 发表于 2018-9-15 13:34
还有这个模块,我都是直接输出到文件。比如时间:事件
能不能举个例子?谢谢了! redapple2008 发表于 2018-9-18 08:53
能不能举个例子?谢谢了!
我不知道有这样的模块,自己写了个函数,输出
Func Send_Msg($Msg = "", $Level = 0)
Global $MsgBox
If $Level == 0 Then
_GUICtrlListBox_InsertString($MsgBox, @YEAR&"/"&@MON&"/"&@MDAY&" "&@HOUR&":"&@MIN&":"&@SEC&" -- "&$Msg, 0)
GUICtrlSetColor($MsgBox, 0x000000)
FileWriteLine($ConfigDir&"\Test_Record.log" ,@YEAR&"/"&@MON&"/"&@MDAY&" "&@HOUR&":"&@MIN&":"&@SEC&" -- "&$Msg)
ElseIf $Level == 1 Then
_GUICtrlListBox_InsertString($MsgBox, @YEAR&"/"&@MON&"/"&@MDAY&" "&@HOUR&":"&@MIN&":"&@SEC&" -- "&$Msg, 0)
GUICtrlSetColor($MsgBox, 0x22B14C)
FileWriteLine($ConfigDir&"\Test_Record.log" ,@YEAR&"/"&@MON&"/"&@MDAY&" "&@HOUR&":"&@MIN&":"&@SEC&" -- "&$Msg)
ElseIf $Level == 2 Then
_GUICtrlListBox_InsertString($MsgBox, @YEAR&"/"&@MON&"/"&@MDAY&" "&@HOUR&":"&@MIN&":"&@SEC&" -- "&$Msg, 0)
;GUICtrlSetData($MsgBox, @YEAR&"/"&@MON&"/"&@MDAY&" "&@HOUR&":"&@MIN&":"&@SEC&" -- "&$Msg)
GUICtrlSetColor($MsgBox, 0xED1C24)
FileWriteLine($ConfigDir&"\Test_Record.log" ,@YEAR&"/"&@MON&"/"&@MDAY&" "&@HOUR&":"&@MIN&":"&@SEC&" -- "&$Msg)
ElseIf $Level == 3 Then
FileWriteLine($ConfigDir&"\Test_Record.log" ,@YEAR&"/"&@MON&"/"&@MDAY&" "&@HOUR&":"&@MIN&":"&@SEC&" -- "&$Msg)
EndIf
EndFunc hualong1009 发表于 2018-9-18 13:54
我不知道有这样的模块,自己写了个函数,输出
谢谢了!十分感谢,有例子就好多了,我再研究研究。 #include <EventLog.au3>
页:
[1]