Write log entry Args: log_type: Log type (REQUEST, RESPONSE, TOOL_RESULT) content: Log content
(self, log_type: str, content: str)
| 157 | self._write_log("TOOL_RESULT", content) |
| 158 | |
| 159 | def _write_log(self, log_type: str, content: str): |
| 160 | """Write log entry |
| 161 | |
| 162 | Args: |
| 163 | log_type: Log type (REQUEST, RESPONSE, TOOL_RESULT) |
| 164 | content: Log content |
| 165 | """ |
| 166 | if self.log_file is None: |
| 167 | return |
| 168 | |
| 169 | with open(self.log_file, "a", encoding="utf-8") as f: |
| 170 | f.write("\n" + "-" * 80 + "\n") |
| 171 | f.write(f"[{self.log_index}] {log_type}\n") |
| 172 | f.write(f"Timestamp: {datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')[:-3]}\n") |
| 173 | f.write("-" * 80 + "\n") |
| 174 | f.write(content + "\n") |
| 175 | |
| 176 | def get_log_file_path(self) -> Path: |
| 177 | """Get current log file path""" |
no outgoing calls
no test coverage detected