简体   繁体   中英

C# Logging Method Execution Performance using Interceptors for normal classes without Interface

This query is regarding performance logging.I am using Log4net for logging. I want to log the time execution for particular method. I have came across Interceptors for logging using Unity Container but its all about Interface and virtual method. In my C# .Net project we have not use interfaces but abstract classes and other normal classes. Is there a way I can use interceptors for logging execution of methods of any normal class?

I am not looking for paid option.

Thanks, Suraj

I found a open source library to get method time execution. Its methodtimer Fody nuget Package. More information here : https://github.com/Fody/MethodTimer When you add this nuget, FodyWeavers.xml file gets added to project. Inside this file, you need to add MethodTimer tag inside the weaver tag Hope this information found helpful to the viewers.

Thanks, Suraj

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM