Monitoring all events in a class and sub-classes
- by Basiclife
Hi,
I wonder if someone can help me. I've got a console App which I use to debug various components as I develop them.
I'd like to be able to log to the console every time an event is fired either in the object I've instantiated or in anything it's instantiated [ad infinitum]. I wouldn't see some of these events normally due to them being consumed further down the chain). Ideally I would be able to log all public and private events but if only public are possible, I can live with that.
I've Googled and all I can find is how to monitor a directory - So I'm not sure if this is not possible or simply has a name that I don't know.
The sort of information I'm after is similar to what's found in an exception - Target Site, Source, Stack Trace, etc...
Could I perhaps do this through reflection somehow?
If someone could tell me if this is even possible and perhaps point me at some good resources, I'd be very grateful.
Many thanks
Basic
To Give you an idea of the console App:
Sub Main()
Container = ContainerGenerate.GenerateContainer()
Dim TemplateID As New Guid("5959b961-b347-46bc-b1b6-cba311304f43")
Dim Templater = Container.Resolve(Of Interfaces.Mail.IMailGenerator)()
Dim MyMessage = Templater.GenerateMail(TemplateID, Nothing, Nothing)
Dim MySMTPClient = Container.Resolve(Of SmtpClient)()
MySMTPClient.Send(MyMessage)
Finish()
End Sub