From 310451ae4d25bfd42d9463d303b8d3ef5466d3ce Mon Sep 17 00:00:00 2001 From: Andrew Hamilton Date: Sat, 25 Apr 2020 15:18:43 +1000 Subject: [PATCH] Remove log file. - It was really only for debugging. - The log would be redundant when eris outputs the log, when run without a tty. --- eris/__main__.py | 8 -------- tests/__main___test.py | 2 +- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/eris/__main__.py b/eris/__main__.py index 7abd515..354ea58 100755 --- a/eris/__main__.py +++ b/eris/__main__.py @@ -573,7 +573,6 @@ class Log: _GREY_BOLD_STYLE = termstr.CharStyle(termstr.Color.grey_100, is_bold=True) _GREEN_STYLE = termstr.CharStyle(termstr.Color.lime) - LOG_PATH = os.path.join(tools.CACHE_PATH, "log") def __init__(self, appearance_changed_event): self._appearance_changed_event = appearance_changed_event @@ -596,18 +595,12 @@ class Log: if timestamp is None else timestamp) line = termstr.TermStr(timestamp, Log._GREY_BOLD_STYLE) + " " + message self.lines.append(line) - with open(Log.LOG_PATH, "a") as log_file: - print(line, file=log_file) self._appearance = None self._appearance_changed_event.set() def log_command(self, message, timestamp=None): self.log_message(message, char_style=Log._GREEN_STYLE) - def delete_log_file(self): - with contextlib.suppress(FileNotFoundError): - os.remove(Log.LOG_PATH) - def appearance(self, dimensions): if self._appearance is None or \ fill3.appearance_dimensions(self._appearance) != dimensions: @@ -1133,7 +1126,6 @@ def main(root_path, loop, worker_count=None, editor_command=None, theme=None, pickle_path, jobs_added_event, appearance_changed_event, root_path, loop) screen.editor_command = editor_command - log.delete_log_file() log.log_message("Program started.") jobs_added_event.set() asyncio.ensure_future(summary.sync_with_filesystem(log)) diff --git a/tests/__main___test.py b/tests/__main___test.py index 7c2b1b6..af1ff92 100755 --- a/tests/__main___test.py +++ b/tests/__main___test.py @@ -222,7 +222,7 @@ class MainTestCase(unittest.TestCase): with contextlib.redirect_stdout(io.StringIO()): __main__.main(root_path, loop, worker_count=2, is_being_tested=True) - for file_name in ["summary.pickle", "creation_time", "log", + for file_name in ["summary.pickle", "creation_time", "foo-metadata", "foo-contents"]: self.assertTrue(os.path.exists(".eris/" + file_name)) self.assertEqual(_mount_total(), mount_total)