开发者

Firing an event everytime a new method is called

开发者 https://www.devze.com 2023-02-28 19:44 出处:网络
I am making a logger for a c# application which needs to log the time when each method was called each method\'s execution time.

I am making a logger for a c# application which needs to log the time when each method was called each method's execution time.

I can do this by calling my own EventLogger.LogMethodCall method at the start of every method, but I was wondering if there was a way to make the CLR fire an even开发者_开发问答t every time a new method is called so I wouldn't have to manually call my method.

Thanks.


Try to look into PostSharp and Aspect Oriented Programming


Perhaps you should use a profiler to get the information you need?


I don't believe that can be done. Rather than write your own logger, may I recommend Log4Net?

0

精彩评论

暂无评论...
验证码 换一张
取 消