Imports DigitalData.Modules.Logging
Imports DigitalData.Services.EDMIService.IDB

Public Class BaseClass
    Friend LogConfig As LogConfig
    Friend Logger As Logger

    Public Sub New(pLogConfig As LogConfig)
        Dim oClassName = [GetType]().Name
        LogConfig = pLogConfig
        Logger = pLogConfig.GetLogger(oClassName)
    End Sub

    ''' <summary>
    ''' 
    ''' </summary>
    ''' <exception cref="ApplicationException"></exception>
    Public Sub LogAndThrow(pMessage As String)
        Logger.Warn(pMessage)
        Throw New ApplicationException(pMessage)
    End Sub

    ''' <summary>
    ''' 
    ''' </summary>
    ''' <exception cref="ApplicationException"></exception>
    Public Sub LogAndThrow(pException As Exception, pMessage As String)
        Logger.Error(pException)
        Throw New ApplicationException(pMessage, pException)
    End Sub
End Class
