Log all function invocations to console

前端 未结 5 1049
醉梦人生
醉梦人生 2021-01-24 01:43

It occurs pretty often that I start debugging a class by logging every function call to console and looking for differences in the bugged cases. Is there some attribute that I c

5条回答
  •  借酒劲吻你
    2021-01-24 01:56

    You can use PostSharp to intercept all method calls and print them even with all arguments and it does not require source code changes. This CodeProject article shows how to do logging with PostSharp.

    Just to note, PostSharp is an aspect-oriented programming (AOP) framework and there are some more.

提交回复
热议问题