feature(info-query): 增加sql日志记录
This commit is contained in:
@@ -2,7 +2,9 @@ package com.lanyuanxiaoyao.service.web.controller;
|
||||
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import com.lanyuanxiaoyao.service.configuration.entity.loki.LokiLogLine;
|
||||
import com.lanyuanxiaoyao.service.forest.service.InfoService;
|
||||
import com.lanyuanxiaoyao.service.forest.service.LokiService;
|
||||
import com.lanyuanxiaoyao.service.web.controller.base.AmisCrudResponse;
|
||||
import com.lanyuanxiaoyao.service.web.controller.base.AmisDetailResponse;
|
||||
import com.lanyuanxiaoyao.service.web.controller.base.AmisResponse;
|
||||
import com.lanyuanxiaoyao.service.web.controller.base.BaseController;
|
||||
@@ -25,10 +27,12 @@ public class LogController extends BaseController {
|
||||
private static final Logger logger = LoggerFactory.getLogger(LogController.class);
|
||||
|
||||
private final LokiService lokiService;
|
||||
private final InfoService infoService;
|
||||
|
||||
@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
|
||||
public LogController(LokiService lokiService) {
|
||||
public LogController(LokiService lokiService, InfoService infoService) {
|
||||
this.lokiService = lokiService;
|
||||
this.infoService = infoService;
|
||||
}
|
||||
|
||||
private String preHandle(String line) {
|
||||
@@ -74,4 +78,9 @@ public class LogController extends BaseController {
|
||||
.collect(this::preHandle)
|
||||
.makeString("\n"));
|
||||
}
|
||||
|
||||
@GetMapping("query_sql_log")
|
||||
public AmisCrudResponse querySQLLog() {
|
||||
return AmisResponse.responseCrudData(infoService.sqlLogs());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user