自动记录日志
This commit is contained in:
@@ -271,7 +271,10 @@ async function executeRedisComparison() {
|
||||
if (response.ok && result.success !== false) {
|
||||
currentResults = result;
|
||||
displayResults(result);
|
||||
showAlert('Redis数据比较完成!', 'success');
|
||||
showAlert('Redis数据比较完成,历史记录已自动保存!', 'success');
|
||||
|
||||
// 刷新历史记录列表(后台已自动保存)
|
||||
loadRedisQueryHistory();
|
||||
} else {
|
||||
showAlert(`比较失败: ${result.error}`, 'danger');
|
||||
}
|
||||
@@ -1067,7 +1070,7 @@ async function loadSelectedRedisHistory() {
|
||||
|
||||
// 如果有原始结果,直接显示
|
||||
if (history.raw_results) {
|
||||
const displayResults = {
|
||||
const resultsData = {
|
||||
stats: history.results_summary,
|
||||
identical_results: history.raw_results.identical_results || [],
|
||||
different_results: history.raw_results.different_results || [],
|
||||
@@ -1079,8 +1082,8 @@ async function loadSelectedRedisHistory() {
|
||||
}
|
||||
};
|
||||
|
||||
currentResults = displayResults;
|
||||
displayResults(displayResults);
|
||||
currentResults = resultsData;
|
||||
displayResults(resultsData);
|
||||
showAlert(`历史记录 "${history.name}" 加载成功`, 'success');
|
||||
} else {
|
||||
showAlert(`历史记录 "${history.name}" 配置加载成功,但没有结果数据`, 'info');
|
||||
@@ -1158,7 +1161,7 @@ async function loadRedisHistoryById(historyId) {
|
||||
|
||||
// 如果有原始结果,直接显示
|
||||
if (history.raw_results) {
|
||||
const displayResults = {
|
||||
const resultsData = {
|
||||
stats: history.results_summary,
|
||||
identical_results: history.raw_results.identical_results || [],
|
||||
different_results: history.raw_results.different_results || [],
|
||||
@@ -1170,8 +1173,8 @@ async function loadRedisHistoryById(historyId) {
|
||||
}
|
||||
};
|
||||
|
||||
currentResults = displayResults;
|
||||
displayResults(displayResults);
|
||||
currentResults = resultsData;
|
||||
displayResults(resultsData);
|
||||
}
|
||||
|
||||
// 关闭管理对话框
|
||||
@@ -1232,7 +1235,7 @@ async function loadRedisQueryLogs() {
|
||||
if (result.success && result.data && result.data.length > 0) {
|
||||
// 过滤Redis相关的日志
|
||||
const redisLogs = result.data.filter(log =>
|
||||
log.message.toLowerCase().includes('redis') ||
|
||||
(log.message && log.message.toLowerCase().includes('redis')) ||
|
||||
log.query_type === 'redis'
|
||||
);
|
||||
|
||||
@@ -1241,11 +1244,15 @@ async function loadRedisQueryLogs() {
|
||||
redisLogs.forEach(log => {
|
||||
const levelClass = log.level === 'ERROR' ? 'text-danger' :
|
||||
log.level === 'WARNING' ? 'text-warning' : 'text-info';
|
||||
const timestamp = log.timestamp || '未知时间';
|
||||
const level = log.level || 'INFO';
|
||||
const message = log.message || '无消息内容';
|
||||
|
||||
html += `
|
||||
<div class="mb-2">
|
||||
<span class="text-muted">[${log.timestamp}]</span>
|
||||
<span class="badge bg-secondary">${log.level}</span>
|
||||
<span class="${levelClass}">${log.message}</span>
|
||||
<span class="text-muted">[${timestamp}]</span>
|
||||
<span class="badge bg-secondary">${level}</span>
|
||||
<span class="${levelClass}">${message}</span>
|
||||
</div>
|
||||
`;
|
||||
});
|
||||
|
Reference in New Issue
Block a user