(AutoIt) Enter/Leave Context in Logging
Demonstrates EnterContext and LeaveContext using the Chilkat Log API.
$oLog = ObjCreate("Chilkat.Log")
; Initialize the log object with an initial context tag:
$oLog.Clear "myLog"
; Add some information..
$oLog.LogInfo "Hello, I'm here..."
; Open a sub-context
$oLog.EnterContext "abc"
; New information is now logged within the "abc" context.
$oLog.LogInfo "This is inside the abc context"
$oLog.LogError "File not found."
; Perhaps open a new context...
$oLog.EnterContext "fileInfo"
$oLog.LogData "filename","something.txt"
$oLog.LogData "path","/somedir/xyz"
$oLog.LeaveContext
; Close the "abc" context.
$oLog.LeaveContext
; Examine the content of the log:
ConsoleWrite($oLog.LastErrorText & @CRLF)
; This is the output:
; myLog:
; Hello, I'm here...
; abc:
; This is inside the abc context
; File not found.
; fileInfo:
; filename: something.txt
; path: /somedir/xyz
; --fileInfo
; --abc
; --myLog
|