Save visible lines (used to export merged lines). Args: path: Path to save to. line_count: Number of lines to save.
(self, path: str, line_count: int)
| 434 | |
| 435 | @work(thread=True) |
| 436 | def save(self, path: str, line_count: int) -> None: |
| 437 | """Save visible lines (used to export merged lines). |
| 438 | |
| 439 | Args: |
| 440 | path: Path to save to. |
| 441 | line_count: Number of lines to save. |
| 442 | """ |
| 443 | try: |
| 444 | with open(path, "w") as file_out: |
| 445 | for line_no in range(line_count): |
| 446 | line = self.get_line_from_index_blocking(line_no) |
| 447 | if line: |
| 448 | file_out.write(f"{line}\n") |
| 449 | except Exception as error: |
| 450 | self.notify(f"Failed to save {path!r}; {error}", severity="error") |
| 451 | else: |
| 452 | self.notify(f"Saved merged log files to {path!r}") |
| 453 | |
| 454 | def get_log_file_from_index(self, index: int) -> tuple[LogFile, int]: |
| 455 | if self._merge_lines is not None: |
nothing calls this directly
no test coverage detected