说我有一个类似这样的类。日志函数调用c中的参数值和返回值#
public static class Config
{
public static string GetAppSetting(string key)
{
return ConfigurationManager.AppSettings[key].ToString();
}
}
,我想每次调用此方法的关键参数&返回值一起记录。
的唯一代码的变化我想提出的是这样的:
[Log]
public static class Config
{
public static string GetAppSetting(string key)
{
return ConfigurationManager.AppSettings[key].ToString();
}
}
我将最有可能使用log4net的记录从日志属性的调用。这怎么能实现?
在此先感谢!
这可能重复好一:http://stackoverflow.com/questions/4133569/how-to-log-method-calls-on-targets-marked-with-an-attribute –