From 5a7223cac053798e8941c6ad770e57d7101c0a7e Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Fri, 23 Apr 2021 15:41:31 +0200 Subject: [PATCH] Logging: Add ClassName Parts for GetFullClassName --- Modules.Logging/LogConfig.vb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Modules.Logging/LogConfig.vb b/Modules.Logging/LogConfig.vb index be543648..e4c88a26 100644 --- a/Modules.Logging/LogConfig.vb +++ b/Modules.Logging/LogConfig.vb @@ -288,7 +288,7 @@ Public Class LogConfig ''' The fully qualified class name ''' This method is very resource-intensive! - 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 oClassName As String = String.Empty Dim oStackTrace = Environment.StackTrace @@ -316,6 +316,16 @@ Public Class LogConfig End If Next + If Parts > 0 Then + Dim oParts = oClassName. + Split("."). + Reverse(). + Take(Parts). + Reverse() + + oClassName = String.Join(".", oParts) + End If + Return oClassName End Function