From 8d1ecc030d5466a6dcfdbe8db75d08b8c8570c6e Mon Sep 17 00:00:00 2001 From: Zevaryx Date: Sun, 1 May 2022 15:30:27 -0600 Subject: [PATCH] Dedicated logger for updates --- jarvis/cogs/botutil.py | 2 +- jarvis/utils/updates.py | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/jarvis/cogs/botutil.py b/jarvis/cogs/botutil.py index 45a0817..b71fe6c 100644 --- a/jarvis/cogs/botutil.py +++ b/jarvis/cogs/botutil.py @@ -77,7 +77,7 @@ class BotutilCog(Scale): @msg_command(name="update") async def _update(self, ctx: MessageContext) -> None: - status = await update(self.bot, self.logger) + status = await update(self.bot) if status: console = Console() with console.capture() as capture: diff --git a/jarvis/utils/updates.py b/jarvis/utils/updates.py index 33c104f..65f597c 100644 --- a/jarvis/utils/updates.py +++ b/jarvis/utils/updates.py @@ -17,10 +17,10 @@ from rich.table import Table import jarvis.cogs if TYPE_CHECKING: - from logging import Logger - from dis_snek.client.client import Snake +logger = logging.getLogger(__name__) + @dataclass class UpdateResult: @@ -105,19 +105,16 @@ def get_git_changes() -> dict: } -async def update(bot: "Snake", logger: "Logger" = None) -> Optional[UpdateResult]: +async def update(bot: "Snake") -> Optional[UpdateResult]: """ Update JARVIS and return an UpdateResult. Args: bot: Bot instance - logger: Logger instance Returns: UpdateResult object """ - if not logger: - logger = logging.getLogger(__name__) repo = git.Repo(".") current_hash = repo.head.object.hexsha origin = repo.remotes.origin