MCPcopy Index your code
hub / github.com/Codeplain-ai/codeplain / CrashLogHandler

Class CrashLogHandler

plain2code_logger.py:89–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87
88
89class CrashLogHandler(logging.Handler):
90 def __init__(self):
91 super().__init__()
92 self.records = []
93
94 def emit(self, record):
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
114def get_log_file_path(plain_file_path: Optional[str], log_file_name: str) -> Optional[str]:

Callers 1

setup_loggingFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected