1

I am currently given a task to add log statements to the project, for every method I need to add same log statement at the beginning of the method and at the end of the method. I am currently using visual studio. Is there any way or is there any option that I can use to add those log statements for all methods without the need of adding them manually.

AI-Bot
  • 29
  • 5

1 Answers1

2

What you need is an Aspect. In C# this can be achieved by using a Fody plugin: https://github.com/vescon/MethodBoundaryAspect.Fody. But be aware. Extensive logging will take down the performance of the application

Michael Mairegger
  • 6,833
  • 28
  • 41