diff options
author | 2024-02-13 22:52:19 +0100 | |
---|---|---|
committer | 2024-02-13 22:52:19 +0100 | |
commit | 27be47d23874e8ae5eeed1bb5b777a0dab90e88a (patch) | |
tree | 5b3189aee819d30ae619ce9c5f22d670e04a1a95 | |
parent | add sentry-sdk package (diff) |
move logger to its own package
This sets the place to centralize all logs configs in its own module
-rw-r--r-- | arthur/__init__.py | 4 | ||||
-rw-r--r-- | arthur/__main__.py | 3 | ||||
-rw-r--r-- | arthur/bot.py | 3 | ||||
-rw-r--r-- | arthur/exts/grafana/team_sync.py | 2 | ||||
-rw-r--r-- | arthur/log.py | 6 |
5 files changed, 11 insertions, 7 deletions
diff --git a/arthur/__init__.py b/arthur/__init__.py index 269a320..a163be5 100644 --- a/arthur/__init__.py +++ b/arthur/__init__.py @@ -2,17 +2,13 @@ import asyncio import os -from functools import partial from typing import TYPE_CHECKING -import loguru from pydis_core.utils import apply_monkey_patches if TYPE_CHECKING: from arthur.bot import KingArthur -logger = loguru.logger.opt(colors=True) -logger.opt = partial(logger.opt, colors=True) apply_monkey_patches() diff --git a/arthur/__main__.py b/arthur/__main__.py index 53e1fb3..6f4a68f 100644 --- a/arthur/__main__.py +++ b/arthur/__main__.py @@ -9,6 +9,7 @@ from discord.ext import commands import arthur from arthur.bot import KingArthur from arthur.config import CONFIG +from arthur.log import logger async def main() -> None: @@ -34,5 +35,5 @@ async def main() -> None: await bot.start(CONFIG.token.get_secret_value()) -with arthur.logger.catch(): +with logger.catch(): asyncio.run(main()) diff --git a/arthur/bot.py b/arthur/bot.py index 8acf6fe..e0caa81 100644 --- a/arthur/bot.py +++ b/arthur/bot.py @@ -9,8 +9,9 @@ from kubernetes_asyncio import config from kubernetes_asyncio.config.kube_config import KUBE_CONFIG_DEFAULT_LOCATION from pydis_core import BotBase -from arthur import exts, logger +from arthur import exts from arthur.config import CONFIG +from arthur.log import logger class KingArthur(BotBase): diff --git a/arthur/exts/grafana/team_sync.py b/arthur/exts/grafana/team_sync.py index 289cebd..20e059e 100644 --- a/arthur/exts/grafana/team_sync.py +++ b/arthur/exts/grafana/team_sync.py @@ -4,9 +4,9 @@ import aiohttp import discord from discord.ext import commands, tasks -from arthur import logger from arthur.apis import github, grafana from arthur.bot import KingArthur +from arthur.log import logger @dataclass(frozen=True) diff --git a/arthur/log.py b/arthur/log.py new file mode 100644 index 0000000..cfc6c62 --- /dev/null +++ b/arthur/log.py @@ -0,0 +1,6 @@ +from functools import partial + +import loguru + +logger = loguru.logger.opt(colors=True) +logger.opt = partial(logger.opt, colors=True) |