Logging: Add ClassName Parts for GetFullClassName

This commit is contained in:
Jonathan Jenne 2021-04-23 15:41:31 +02:00
parent 857c559e01
commit 5a7223cac0

View File

@ -288,7 +288,7 @@ Public Class LogConfig
''' <returns>The fully qualified class name</returns> ''' <returns>The fully qualified class name</returns>
''' <remarks>This method is very resource-intensive!</remarks> ''' <remarks>This method is very resource-intensive!</remarks>
<DebuggerStepThrough()> <DebuggerStepThrough()>
Public Shared Function GetClassFullName(Optional IncludeMethodNames As Boolean = False) As String Public Shared Function GetClassFullName(Optional IncludeMethodNames As Boolean = False, Optional Parts As Integer = 0) As String
Dim oFramesToSkip As Integer = 2 Dim oFramesToSkip As Integer = 2
Dim oClassName As String = String.Empty Dim oClassName As String = String.Empty
Dim oStackTrace = Environment.StackTrace Dim oStackTrace = Environment.StackTrace
@ -316,6 +316,16 @@ Public Class LogConfig
End If End If
Next Next
If Parts > 0 Then
Dim oParts = oClassName.
Split(".").
Reverse().
Take(Parts).
Reverse()
oClassName = String.Join(".", oParts)
End If
Return oClassName Return oClassName
End Function End Function