The “Initialize” prints a few lines to the log file, 2) Calls a function which prints a few lines to the log, 3) returns to Initilize where it once again prints.
Unfortuantly does it all take a while and the lines are printed mixed with other debug from the server… I would like to get the lines printed in one go/scope.
How can I do this? Can I return an object/array from my function containing my strings and the print it all when I reach the end of Initialize?
This class will allow you to log your messages to a seperate database or a mail memo.
Alternatively, you could write your own class called eg Logger which would collect all the messages logged to it and then print them all out at once. You would need to either pass the Logger into all your functions or declare it as a global variable.
Your own Logger class might look something like this:
Class Logger
Private messages List As String
Private count As Integer
Sub new()
Me.count = 0
End Sub
Public Sub log( message As String )
messages( count ) = message
count = count + 1
End Sub
Public Sub dump()
Forall message In messages
Print( message )
End Forall
End Sub