How to configure a logging interceptor for all registered type in Unity?

前端 未结 1 1241
遥遥无期
遥遥无期 2021-01-05 14:32

I am going to trace every actions happened in the services which are managed by the Unity Container as logs in file system. I suppose I could define an interface named IServ

1条回答
  •  时光取名叫无心
    2021-01-05 15:05

    There are many ways to implement the logger. Long time ago I wrote an article about how to set up interceptors:

    http://hmadrigal.wordpress.com/2010/12/25/aspect-oriented-programming-and-interceptor-design-pattern-with-unity-2/

    For logging you could use Debug.Write, and configure TraceListeners. Or also you could Use Enterprise Library or any third party log library.

    Kind regards, Herber

    0 讨论(0)
提交回复
热议问题