refactor(thinking): extract antigravity logic into a dedicated provider

This commit is contained in:
hkfires
2026-01-15 19:08:22 +08:00
parent fe5b3c80cb
commit 4ad6189487
6 changed files with 205 additions and 90 deletions

View File

@@ -55,23 +55,15 @@ func (m *LogFormatter) Format(entry *log.Entry) ([]byte, error) {
}
levelStr := fmt.Sprintf("%-5s", level)
// Build fields string (excluding request_id which is already shown)
// Build fields string (only print fields in logFieldOrder)
var fieldsStr string
if len(entry.Data) > 0 {
seen := make(map[string]bool)
var fields []string
for _, k := range logFieldOrder {
if v, ok := entry.Data[k]; ok {
fields = append(fields, fmt.Sprintf("%s=%v", k, v))
seen[k] = true
}
}
for k, v := range entry.Data {
if k == "request_id" || seen[k] {
continue
}
fields = append(fields, fmt.Sprintf("%s=%v", k, v))
}
if len(fields) > 0 {
fieldsStr = " " + strings.Join(fields, " ")
}