Class BufferedOperationLogger
java.lang.Object
org.shoulder.log.operation.logger.impl.BufferedOperationLogger
- All Implemented Interfaces:
OperationLogger
带缓冲的操作日志记录器(针对频繁记录单条操作日志做优化,批量操作不优化)
将日志放入 buffer 中,当 buffer 中日志达到一定数量 / 每隔一定时间,执行一次批量保存
- Author:
- lym
-
Constructor Summary
ConstructorsConstructorDescriptionBufferedOperationLogger(Queue<OperationLogDTO> logBuffer, OperationLogger delegate, ScheduledExecutorService scheduledExecutorService, long flushInterval, int flushThreshold, int perFlushMax) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddInterceptor(OperationLoggerInterceptor logInterceptor) 注册拦截器voidvoidlog(Collection<? extends OperationLogDTO> opLogList) 记录多条操作日志voidlog(OperationLogDTO opLog) 记录一条操作日志voidlog(OperationLogDTO opLog, List<? extends Operable> operableList) 组装并记录多条操作日志voidMethods 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
-
Constructor Details
-
BufferedOperationLogger
public BufferedOperationLogger(Queue<OperationLogDTO> logBuffer, OperationLogger delegate, ScheduledExecutorService scheduledExecutorService, long flushInterval, int flushThreshold, int perFlushMax)
-
-
Method Details
-
log
记录一条操作日志- Specified by:
login interfaceOperationLogger- Parameters:
opLog- 操作日志对象
-
log
记录多条操作日志- Specified by:
login interfaceOperationLogger- Parameters:
opLogList- 操作日志对象集合
-
log
Description copied from interface:OperationLogger组装并记录多条操作日志- Specified by:
login interfaceOperationLogger- Parameters:
opLog- 记录模板operableList- 被操作对象集合
-
addInterceptor
Description copied from interface:OperationLogger注册拦截器- Specified by:
addInterceptorin interfaceOperationLogger- Parameters:
logInterceptor- 拦截器
-
getDelegate
-
consumerLog
public void consumerLog() -
preDestroy
@PreDestroy public void preDestroy()
-