1 Star 0 Fork 0

Karl_Albright/CSharpDemo

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
LoggingAttribute.cs 962 Bytes
一键复制 编辑 原始数据 按行查看 历史
xuzhongye 提交于 11个月前 . 细节调整
using Newtonsoft.Json;
using Rougamo;
using Rougamo.Context;
namespace RougamoDemo
{
[AttributeUsage(AttributeTargets.Method)]
public class LoggingAttribute : MoAttribute
{
public override void OnEntry(MethodContext context)
{
Console.WriteLine("执行方法 {0}() 开始,参数:{1}.", context.Method.Name,
JsonConvert.SerializeObject(context.Arguments));
}
public override void OnException(MethodContext context)
{
Console.WriteLine("执行方法 {0}() 异常,{1}.", context.Method.Name, context.Exception.Message);
}
public override void OnExit(MethodContext context)
{
Console.WriteLine("执行方法 {0}() 结束.", context.Method.Name);
}
public override void OnSuccess(MethodContext context)
{
Console.WriteLine("执行方法 {0}() 成功.", context.Method.Name);
}
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C#
1
https://gitee.com/Karl_Albright/csharp-demo.git
git@gitee.com:Karl_Albright/csharp-demo.git
Karl_Albright
csharp-demo
CSharpDemo
master

搜索帮助