NET中使用AOP记录 [英] Logging with AOP in .net

查看:59
本文介绍了NET中使用AOP记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经厌倦了在c#应用程序中每个函数的开头使用Logger.Log("MyMethod"),并开始研究AOP如何为我提供帮助.

I'm tired of using Logger.Log("MyMethod") at the beginning of each function in my c# application and started to look at how AOP can help me.

基本上我想要的是登录到每个方法(公共和私有)的输入. 互联网上有很多关于此的讨论,但是我还没有找到任何特定的库,借助它,我可以在方法的前面加上[Log]属性作为前缀.

Basically what I want is to log entering to every method (public and private). There are a lot of talks about this around the internet, but I hadn't found any specific library, with help of which I'll be able to just prefix my method with [Log] attribute and that's it.

有一个 Log4PostSharp 似乎很完美,但仅可与PostSharp 1.5一起使用,目前尚不可用.

There's Log4PostSharp which seems to be perfect, but only works with PostSharp 1.5 which isn't available at the moment.

有一些类似于Log4PostSharp的东西吗?

Are there some similar to Log4PostSharp things?

感谢帮助

推荐答案

版本2可用. http://code.google.com/p/postsharp-user-plugins /downloads/list

这篇关于NET中使用AOP记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆