优化抢购流程日志和复验性能
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user