EGMono
02-20-2012, 10:30 AM
Apologies if this has been covered before, but I searched the forum and read through examples and still don't quite get it...
What I am trying to accomplish is create a generic logging interface (I call it ILogger) that has one method, sWrite( sMessage As String ), that I implement in cFileLogger that writes to a file, and also in cDbgLogger that uses MsgBox to write to screen. The point of this all is that I would like to use RaiseEvent to notify any objects based on these classes, if they exist, that there is something they need to record to the log. I would like the flexibility of having 0 or more logging classes without having to change the code that broadcasts to them. For example, an error handler that logs the error, but a switch to turn on and off writing the messages to the screen.
Is this possible? Or am I totally missing the point of RaiseEvent?
What I am trying to accomplish is create a generic logging interface (I call it ILogger) that has one method, sWrite( sMessage As String ), that I implement in cFileLogger that writes to a file, and also in cDbgLogger that uses MsgBox to write to screen. The point of this all is that I would like to use RaiseEvent to notify any objects based on these classes, if they exist, that there is something they need to record to the log. I would like the flexibility of having 0 or more logging classes without having to change the code that broadcasts to them. For example, an error handler that logs the error, but a switch to turn on and off writing the messages to the screen.
Is this possible? Or am I totally missing the point of RaiseEvent?