Fody/MethodTimer

get Elapsed property in Interceptor

alextroto opened this issue · 8 comments

Hi,
There are cases where high-resolution accuracy it's need it, so it would be great to get Elapsed property in Interceptor.

how would this be done in a non breaking way?

Maybe a new Interceptor ?

public static class MethodTimeHiResLogger
{
    public static void Log(MethodBase methodBase, TimeSpan elapsed)
    {
        //Do some logging here
    }
}

That sounds reasonable. Can you submit a PR.

I'm not very familiar with Fody but I'll try to understand how it's working.
In the meantime, if someone can submit a PR, it would be great.

Instead of adding a different class, why not add this (optional!) method:

    public static void Log(MethodBase methodBase, TimeSpan duration, string message)
    {
        //Do some logging here
    }

The weaver can auto-detect whether it's available or not.

@GeertvanHorrik happy with that

Cool, I will try to find time beginning next week to implement his.

thanks to @GeertvanHorrik this is now implemented. it is also deployed to nuget