Skip to content

Commit

Permalink
feat: Log error in a file
Browse files Browse the repository at this point in the history
  • Loading branch information
KIRA009 committed Jun 11, 2024
1 parent e59af88 commit 4d11b59
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions openadapt/entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
# This needs to be called before any code that uses multiprocessing
multiprocessing.freeze_support()

from datetime import datetime

from openadapt.build_utils import redirect_stdout_stderr
from openadapt.build_utils import get_root_dir_path, redirect_stdout_stderr


def run_openadapt() -> None:
Expand All @@ -20,8 +21,10 @@ def run_openadapt() -> None:
print_config()
load_alembic_context()
tray._run()
except Exception:
pass
except Exception as exc:
data_dir = get_root_dir_path()
with open(data_dir / "error.log", "a") as f:
f.write(f"{datetime.now()}: {exc}\n")


if __name__ == "__main__":
Expand Down

0 comments on commit 4d11b59

Please sign in to comment.