(self, filepath, formatter=None)
| 95 | self.records.append(record) |
| 96 | |
| 97 | def dump_to_file(self, filepath, formatter=None): |
| 98 | if not self.records: |
| 99 | return False |
| 100 | |
| 101 | try: |
| 102 | with open(filepath, "w", encoding="utf-8") as f: |
| 103 | for record in self.records: |
| 104 | if formatter: |
| 105 | msg = formatter.format(record) |
| 106 | else: |
| 107 | msg = self.format(record) |
| 108 | f.write(msg + "\n") |
| 109 | return True |
| 110 | except Exception: |
| 111 | return False |
| 112 | |
| 113 | |
| 114 | def get_log_file_path(plain_file_path: Optional[str], log_file_name: str) -> Optional[str]: |
no test coverage detected