Spaces:
Build error
Build error
class MarkdownLogger: | |
def __init__(self): | |
self._log = '' | |
self._messages = [] | |
def log_text(self, text): | |
self._log += '\n' + text + '\n' | |
def log_code(self, code): | |
self._log += f'\n```python\n{code}\n```\n' | |
def log_message(self, text): | |
self._messages.append(text) | |
def clear(self): | |
self._log = '' | |
def get_log(self): | |
return self._log | |
def get_messages(self): | |
m = self._messages | |
self._messages = [] | |
return m | |