| 73 | } |
| 74 | |
| 75 | async fn create_log_dump(&self, zip_path: &Path, logs_dir: PathBuf) -> Result<usize, Box<dyn std::error::Error>> { |
| 76 | let file = std::fs::File::create(zip_path)?; |
| 77 | let mut zip = ZipWriter::new(file); |
| 78 | let mut log_count = 0; |
| 79 | |
| 80 | // Collect qchat.log |
| 81 | log_count += Self::collect_qchat_log(&mut zip, &logs_dir)?; |
| 82 | |
| 83 | // Collect mcp.log if --mcp flag is set |
| 84 | if self.mcp { |
| 85 | log_count += Self::collect_mcp_log(&mut zip, &logs_dir)?; |
| 86 | } |
| 87 | |
| 88 | zip.finish()?; |
| 89 | Ok(log_count) |
| 90 | } |
| 91 | |
| 92 | fn collect_qchat_log( |
| 93 | zip: &mut ZipWriter<std::fs::File>, |