Fody/MethodTimer

Write to Trace instead of Debug

SimonCropp opened this issue · 0 comments

so instead of

public void MyMethod()
{
    var stopwatch = Stopwatch.StartNew();
    try
    {
        //Some code u are curious how long it takes
        Console.WriteLine("Hello");
    }
    finally
    {
        stopwatch.Stop();
        Debug.WriteLine("MyClass.MyMethod " + stopwatch.ElapsedMilliseconds + "ms");
    }
}

it will do this

public void MyMethod()
{
    var stopwatch = Stopwatch.StartNew();
    try
    {
        //Some code u are curious how long it takes
        Console.WriteLine("Hello");
    }
    finally
    {
        stopwatch.Stop();
        Trace.WriteLine("MyClass.MyMethod " + stopwatch.ElapsedMilliseconds + "ms");
    }
}