feat: add millisecond-precision timestamps to all log entries (#91)

- Add timestamp prefix format [YYYY-MM-DD HH:MM:SS.mmm] to every log entry
- Resolves issue where logs lacked time information, making it impossible to determine when events (like "Unknown event format" errors) occurred
- Update tests to handle new timestamp format by stripping prefixes during validation
- All 27+ tests pass with new format

Implementation:
- Modified logger.go:369-370 to inject timestamp before message
- Updated concurrent_stress_test.go to strip timestamps for format checks

Fixes #81

Generated with SWE-Agent.ai

Co-authored-by: SWE-Agent.ai <noreply@swe-agent.ai>
This commit is contained in:
ben
2025-12-21 18:57:27 +08:00
committed by GitHub
parent 1f42bcc1c6
commit eec844d850
2 changed files with 15 additions and 3 deletions

View File

@@ -366,7 +366,8 @@ func (l *Logger) run() {
defer ticker.Stop()
writeEntry := func(entry logEntry) {
fmt.Fprintf(l.writer, "%s\n", entry.msg)
timestamp := time.Now().Format("2006-01-02 15:04:05.000")
fmt.Fprintf(l.writer, "[%s] %s\n", timestamp, entry.msg)
// Cache error/warn entries in memory for fast extraction
if entry.isError {