NutzCN Logo
问答 操作成功或者失败的日志记录
发布于 2639天前 作者 果粉 1612 次浏览 复制 上一个帖子 下一个帖子
标签: slog

示例: @SLog(tag = "添加角色", msg = "角色名称:${args[1].name}")
如何记录操作 成功或失败

5 回复

自行扩展一下 SysLogAopInterceptor

扩展这个吗
protected void doLog(String t, InterceptorChain chain, Throwable e) {
String _msg = null;
if (msg.hasKey()) {
Context ctx = Lang.context();
ctx.set("args", chain.getArgs());
ctx.set("return", chain.getReturn());
Context _ctx = Lang.context();
for (String key : msg.keys()) {
_ctx.set(key, els.get(key).eval(ctx));
}
_msg = msg.render(_ctx).toString();
} else {
_msg = msg.getOrginalString();
}
SysLog sysLog = SysLog.c(t, tag, _msg, source);
if (sLogService == null)
sLogService = ioc.get(SLogService.class);
if (async)
sLogService.async(sysLog);
else
sLogService.sync(sysLog);
}

@wendal
good_topics分支和master,3.0x是什么关系?
SysLog相关功能代码在master和3.0x里面不存在了?没找到

添加回复
请先登陆
回到顶部