优化抢购流程日志和复验性能

This commit is contained in:
yml2213
2026-06-27 08:07:21 +08:00
parent c244cc0833
commit c90f80045e
10 changed files with 446 additions and 180 deletions
+8 -2
View File
@@ -43,16 +43,22 @@ func (s *MemoryLogStore) Write(p []byte) (int, error) {
if strings.TrimSpace(line) == "" {
continue
}
category, level := ParseLogMeta(line)
meta := ParseLogLine(line)
category, level := meta.Category, meta.Level
if level == "" {
level = DetectLogLevel(line)
}
logTime := meta.Time
if logTime == "" {
logTime = time.Now().In(constants.CST).Format("2006-01-02 15:04:05.000")
}
s.nextID++
s.entries = append(s.entries, types.LogEntry{
ID: s.nextID,
Time: time.Now().In(constants.CST).Format("2006-01-02 15:04:05.000"),
Time: logTime,
Level: level,
Category: category,
Account: meta.Account,
Message: line,
})
if len(s.entries) > s.max {