AddChildLoggingContext

Function AddChildLoggingContext(context: ^loggingContexts, add: ^loggingContexts) : Boolean

context: A loggingContext created by CreateLoggingContext

add: A loggingContext created by CreateLoggingContext that will become a child of context

Returns TRUE on success

This function makes a loggingContext a child of another loggingContext. Whenever the parent context is indented or logged to, the child loggingContext is also updated. This is particularly useful if you use a seperate debug log and an error log - any events logged to the error log can be automatically added to the debug log as well.

Example:

Program
   Uses

       hlog

Var
   verboseLog: ^loggingContexts
   debugLog: ^loggingContexts
   errorLog: ^loggingContexts
   
   i : Integer
   
Begin
   verboseLog = CreateLoggingContext("verbose.log", FALSE)
   debugLog = CreateLoggingContext("debug.log", TRUE)
   errorLog = CreateLoggingContext("error.log", TRUE)

   // Any error Log entries are also added to the debug log
   AddChildLoggingContext(errorLog, debugLog)
   
   // And debug Log entries are also added to the verbose log
   // This means that any error Log entries are also added to
   // the verbose Log.

   AddChildLoggingContext(debugLog, verboseLog)
   
   LogMsg(errorLog, "Error")
   LogMsg(debugLog, "Debug")
   LogMsg(verboseLog, "Verbose")
   
   FreeAllLoggingContexts() // Verbose needs to be committed
   
End

error.log

2          Error

debug.log

3          Error
4          Debug

verbose.log

4          Error
5          Debug
5          verbose