From f6e645971d7d22a0c2c4ad228860d3d71c3d0c06 Mon Sep 17 00:00:00 2001 From: Leviaria <113382526+Leviaria@users.noreply.github.com> Date: Tue, 9 Jul 2024 00:47:12 +0200 Subject: [PATCH] Update main.py --- main.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 7aa89b8..1667cdc 100644 --- a/main.py +++ b/main.py @@ -4,6 +4,8 @@ import threading import time +from loguru import logger + from clashroyalebuildabot.actions.archers_action import ArchersAction from clashroyalebuildabot.actions.giant_action import GiantAction from clashroyalebuildabot.actions.goblin_barrel_action import ( @@ -18,6 +20,14 @@ start_time = datetime.now() +logger.remove() +logger.add( + sys.stderr, + format="{time} {level} {message}", + backtrace=False, + diagnose=False, +) + def update_terminal_title(): while True: @@ -41,8 +51,12 @@ def main(): MinipekkaAction, MusketeerAction, } - bot = Bot(actions=actions) - bot.run() + try: + bot = Bot(actions=actions) + bot.run() + except Exception as e: + logger.error(f"An error occurred: {e}") + sys.exit(1) if __name__ == "__main__":