Call an event every time a new method is called

I am making a logger for a C # application which should log the time when each method was called by each method execution time.

I can do this by calling my own EventLogger.LogMethodCall method at the beginning of each method, but I was wondering if the CLR method would fire an event every time a new method is called so that I would not have to manually call my method.

Thanks.

+7
source share
3 answers

Try a glimpse into PostSharp and aspect-oriented programming

+4
source

Perhaps you need to use the profiler to get the necessary information?

+1
source

I do not think that this can be done. Instead of writing my own registrar, can I recommend Log4Net?

0
source

All Articles