/ Published in: Visual Basic
A helper class which adds the ability to log exceptions to the Windows event log, including the class and method in which they occurred, to a class that derives from it.
The event source name defaults to the application title, but can be overridden by passing a string to the constructor (i.e. MyBase.New("MyApp") in the derived class).
e.g.
Public Class Test
Inherits ExceptionLogger
Public Sub Test()
Try
Throw New ApplicationException("Test exception", New Exception("Test inner exception"))
Catch ex As Exception
LogException(ex)
End Try
End Sub
End Class
The event source name defaults to the application title, but can be overridden by passing a string to the constructor (i.e. MyBase.New("MyApp") in the derived class).
e.g.
Public Class Test
Inherits ExceptionLogger
Public Sub Test()
Try
Throw New ApplicationException("Test exception", New Exception("Test inner exception"))
Catch ex As Exception
LogException(ex)
End Try
End Sub
End Class