优化抖动幅度和日志双时间显示
- jitterDuration 抖动从 base/3 降至 base/10,避免过大的随机延迟 - 日志新增斗鱼双时间显示:本地时间后追加 (D斗鱼时间),前端蓝色高亮 - 时间校准后自动同步斗鱼偏移量到日志模块
This commit is contained in:
@@ -157,6 +157,7 @@ const handleVerify = async () => {
|
||||
<template v-if="log.source === 'server'">
|
||||
<span class="log-prefix">[后端]</span>
|
||||
<span v-if="log.time" class="log-time">[{{ log.time }}]</span>
|
||||
<span v-if="log.douyuTime" class="log-douyu-time">D:{{ log.douyuTime }}</span>
|
||||
<span v-if="log.category" class="log-cat">{{ log.category }}</span>
|
||||
<span v-if="log.account" class="log-account">{{ log.account }}</span>
|
||||
<span class="log-msg">{{ log.message }}</span>
|
||||
@@ -363,6 +364,13 @@ const handleVerify = async () => {
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.log-douyu-time {
|
||||
color: var(--accent);
|
||||
flex-shrink: 0;
|
||||
font-size: 10px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.log-cat {
|
||||
display: inline-block;
|
||||
padding: 0 4px;
|
||||
|
||||
@@ -12,6 +12,7 @@ export interface LogEntry {
|
||||
|
||||
export interface LogMessage {
|
||||
time: string
|
||||
douyuTime?: string
|
||||
type: 's' | 'e' | 'i' | 'w' | 'd'
|
||||
message: string
|
||||
category?: string
|
||||
@@ -40,8 +41,15 @@ const formatServerLogTime = (time: string): string => {
|
||||
return match ? match[0] : value
|
||||
}
|
||||
|
||||
// 从消息中提取斗鱼时间 (D16:25:00.047)
|
||||
const extractDouyuTime = (message: string): string => {
|
||||
const match = String(message || '').match(/\(D(\d{2}:\d{2}:\d{2}\.\d{3})\)/)
|
||||
return match ? match[1] : ''
|
||||
}
|
||||
|
||||
const cleanServerLogMessage = (message: string): string => {
|
||||
return String(message || '')
|
||||
.replace(/^\d{4}\/\d{2}\/\d{2}\s+\d{2}:\d{2}:\d{2}(?:\.\d{3})?\s*\(D\d{2}:\d{2}:\d{2}\.\d{3}\)\s*/i, '')
|
||||
.replace(/^\d{4}\/\d{2}\/\d{2}\s+\d{2}:\d{2}:\d{2}(?:\.\d{3})?\s*/i, '')
|
||||
.replace(/\[[^\]]+\]\[(debug|info|success|warn|error)\]\s*/i, '')
|
||||
.replace(/^\[账号:[^\]]+\]\s*/i, '')
|
||||
@@ -97,9 +105,11 @@ export function useLogs() {
|
||||
|
||||
// 清理后端结构化前缀,时间/分类/账号由独立字段展示。
|
||||
const cleanMsg = cleanServerLogMessage(item.message)
|
||||
const dyTime = extractDouyuTime(item.message)
|
||||
|
||||
logs.value.push({
|
||||
time: formatServerLogTime(item.time || ''),
|
||||
douyuTime: dyTime || undefined,
|
||||
type,
|
||||
message: cleanMsg,
|
||||
category: item.category,
|
||||
|
||||
Reference in New Issue
Block a user