Class AbstractOperationLogger
java.lang.Object
org.shoulder.log.operation.logger.AbstractOperationLogger
- All Implemented Interfaces:
OperationLogger
- Direct Known Subclasses:
JdbcOperationLogger,LogOperationLogger
基础操作日志记录,封装了记录前后触发逻辑
记录前先校验,若日志不符合自己的规范要求则不记录这条操作日志,并在运行日志中记录为什么不合规
- Author:
- lym
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddInterceptor(OperationLoggerInterceptor logInterceptor) 注册拦截器protected abstract voiddoLog(OperationLogDTO opLog) 子类需要实现具体如何记录日志protected voidhandleLogException(Exception e, OperationLogDTO opLog) 默认记录一条warn日志,但子类可以覆盖当记录日志时出现异常如何处理voidlog(Collection<? extends OperationLogDTO> opLogList) 记录多条操作日志 【性能】默认单条循环,扩展时可考虑覆盖默认实现,支持真正的批量操作 【扩展】自行实现时,也可自己定义批量记录前后置处理器voidlog(OperationLogDTO opLog) 记录一条操作日志voidlog(OperationLogDTO opLog, List<? extends Operable> operableList) 拼装循环记录多条操作日志Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.shoulder.log.operation.logger.OperationLogger
log
-
Field Details
-
log
protected final org.slf4j.Logger log
-
-
Constructor Details
-
AbstractOperationLogger
public AbstractOperationLogger()
-
-
Method Details
-
log
记录一条操作日志- Specified by:
login interfaceOperationLogger- Parameters:
opLog- 操作日志对象
-
log
记录多条操作日志 【性能】默认单条循环,扩展时可考虑覆盖默认实现,支持真正的批量操作 【扩展】自行实现时,也可自己定义批量记录前后置处理器- Specified by:
login interfaceOperationLogger- Parameters:
opLogList- 操作日志对象集合
-
log
拼装循环记录多条操作日志- Specified by:
login interfaceOperationLogger- Parameters:
opLog- 记录模板operableList- 被操作对象集合
-
doLog
子类需要实现具体如何记录日志- Parameters:
opLog- 需要记录日志的实体
-
handleLogException
默认记录一条warn日志,但子类可以覆盖当记录日志时出现异常如何处理- Parameters:
e- 具体是什么异常opLog- 需要记录日志的实体
-
addInterceptor
Description copied from interface:OperationLogger注册拦截器- Specified by:
addInterceptorin interfaceOperationLogger- Parameters:
logInterceptor- 拦截器
-