| 6 | |
| 7 | |
| 8 | class DebugFileWriter: |
| 9 | def __init__(self): |
| 10 | if not IS_DEBUG_ENABLED: |
| 11 | return |
| 12 | |
| 13 | try: |
| 14 | self.debug_artifacts_path = os.path.expanduser( |
| 15 | f"{DEBUG_DIR}/{str(uuid.uuid4())}" |
| 16 | ) |
| 17 | os.makedirs(self.debug_artifacts_path, exist_ok=True) |
| 18 | print(f"Debugging artifacts will be stored in: {self.debug_artifacts_path}") |
| 19 | except: |
| 20 | logging.error("Failed to create debug directory") |
| 21 | |
| 22 | def write_to_file(self, filename: str, content: str) -> None: |
| 23 | try: |
| 24 | with open(os.path.join(self.debug_artifacts_path, filename), "w") as file: |
| 25 | file.write(content) |
| 26 | except Exception as e: |
| 27 | logging.error(f"Failed to write to file: {e}") |
| 28 | |
| 29 | def extract_html_content(self, text: str) -> str: |
| 30 | return str(text.split("<html>")[-1].rsplit("</html>", 1)[0] + "</html>") |
nothing calls this directly
no outgoing calls
no test coverage detected