Cosi:
using System.Diagnostics; void Log(string eventMessage) { Console.WriteLine("Event logged by " + (new StackTrace()).GetFrame(1).GetMethod().Name); Console.WriteLine("Event: " + eventMessage); }
Fonte: Tips & Tricks for ASP.NET, IIS, and Visual Web Developer