.NET Fiddle

CSharp · Console

/Program.cs

using System;
using System.Reflection;
using Logging;
using System.Collections.Generic;
					
class Program
{
    static void Main(string[] args)
    {
		var logger = new DebugLogger(new DebugLogger.DebugLoggerConfig()
									 {
										 MethodsWithContextLogging = new HashSet<MethodBase>()
										 {
											 typeof(A).GetMethod("Go", BindingFlags.NonPublic | BindingFlags.Instance),
											 typeof(B).GetMethod("Go", BindingFlags.NonPublic | BindingFlags.Instance)
										 }
									 });
        A a = new A();
        a.Go(1);
    }
}

public class A
{
    internal void Go(int x)
    {
        B b = new B();
        b.Go(4);
    }
}

public class B
{
    internal void Go(int y)
    {
        Console.WriteLine("do not need GetStackFrame()");
    }
}
;