Write a timestamped log entry.
(self, category: str, message: str, **kwargs)
| 65 | f.write(f"=== PID: {os.getpid()} ===\n\n") |
| 66 | |
| 67 | def log(self, category: str, message: str, **kwargs): |
| 68 | """Write a timestamped log entry.""" |
| 69 | timestamp = datetime.now().strftime("%H:%M:%S.%f")[:-3] |
| 70 | with self._lock: |
| 71 | with open(self.log_file, "a") as f: |
| 72 | f.write(f"[{timestamp}] [{category}] {message}\n") |
| 73 | for key, value in kwargs.items(): |
| 74 | f.write(f" {key}: {value}\n") |
| 75 | f.write("\n") |
| 76 | |
| 77 | def section(self, title: str): |
| 78 | """Write a section header.""" |