dbgWritef appends one timestamped record. No-op when logging is off. The timestamp carries the date too (not just the clock) so a shared log is unambiguous across day boundaries and correlatable with other tooling.
(category, format string, args ...any)
| 88 | // timestamp carries the date too (not just the clock) so a shared log is |
| 89 | // unambiguous across day boundaries and correlatable with other tooling. |
| 90 | func dbgWritef(category, format string, args ...any) { |
| 91 | dbgMu.Lock() |
| 92 | defer dbgMu.Unlock() |
| 93 | if dbgFile == nil { |
| 94 | return |
| 95 | } |
| 96 | ts := time.Now().Format("2006-01-02 15:04:05.000") |
| 97 | body := fmt.Sprintf(format, args...) |
| 98 | fmt.Fprintf(dbgFile, "[%s] %s\n%s\n\n", ts, category, body) |
| 99 | } |
| 100 | |
| 101 | // dbgWriteSession records the active backend and context budget once at startup. |
| 102 | // Behaviour differs sharply by model (different model families fail in |
no outgoing calls
no test coverage detected