public class Slf4JLogInterceptor extends Object implements Interceptor
| 限定符和类型 | 字段和说明 |
|---|---|
protected static String |
defaultQueryMethod |
protected static String |
lambdaQueryName |
protected static String |
LINE_SEPARATOR |
protected static String |
mapperName |
protected String |
preferredShowClass
自定义输出行号时优先输出的类,而不是SQLManager或者是BaseMapper
// TODO 预留,后面需要做配置
|
protected static String |
queryClassName |
protected boolean |
showLineNum
显示sql所在行号, 开销较大
// TODO 预留,后面需要做配置
|
protected static String |
sqlManager |
| 构造器和说明 |
|---|
Slf4JLogInterceptor() |
Slf4JLogInterceptor(boolean showLineNum,
String preferredShowClass) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
after(InterceptorContext ctx)
SQL正常执行后调用
|
void |
before(InterceptorContext ctx)
SQL执行前调用
|
protected void |
error(String str) |
void |
exception(InterceptorContext ctx,
Exception ex)
SQL执行异常后调用
|
protected List<String> |
formatParas(List<SQLParameter> list) |
static String |
formatSql(String sql) |
protected String |
formatSqlId(String id) |
protected int |
lookBusinessCodeInTrace(StackTraceElement[] traces) |
protected void |
print(String str) |
protected static final String LINE_SEPARATOR
protected static String mapperName
protected static String sqlManager
protected static String queryClassName
protected static String lambdaQueryName
protected static String defaultQueryMethod
protected boolean showLineNum
protected String preferredShowClass
public Slf4JLogInterceptor()
public Slf4JLogInterceptor(boolean showLineNum,
String preferredShowClass)
public void before(InterceptorContext ctx)
before 在接口中 Interceptorctx - InterceptorContextpublic void after(InterceptorContext ctx)
after 在接口中 Interceptorctx - InterceptorContextpublic void exception(InterceptorContext ctx, Exception ex)
exception 在接口中 Interceptorctx - InterceptorContextex - SQL执行异常信息protected int lookBusinessCodeInTrace(StackTraceElement[] traces)
protected List<String> formatParas(List<SQLParameter> list)
protected void print(String str)
protected void error(String str)
Copyright © 2021. All rights reserved.