Skip to content

Commit

Permalink
fix: aiogram_broadcaster logging d
Browse files Browse the repository at this point in the history
aiogram_broadcaster logging disabled
  • Loading branch information
TimNekk authored Aug 12, 2022
2 parents 9cc551f + d8f52f2 commit 9ebf643
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
aiogram~=2.18
aioredis~=2.0
environs~=9.0
aiogram-broadcaster
git+https://github.com/TimNekk/aiogram_broadcaster.git
gino
loguru
alembic
Expand Down
9 changes: 5 additions & 4 deletions tgbot/misc/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,14 @@ def emit(self, record: logging.LogRecord) -> None:


def setup(file_name: str = "log", rotation: time = time(), retention: timedelta = timedelta(days=3)) -> None:
# Send default logging to loguru
logging.basicConfig(handlers=[InterceptHandler()], level=0)

# Disable aiogram_broadcaster logging
logging.getLogger("root").setLevel(logging.FATAL)
logging.getLogger("aiogram_broadcaster.text_broadcaster").setLevel(logging.FATAL)
logging.getLogger("aiogram_broadcaster.message_broadcaster").setLevel(logging.FATAL)

# Setup loguru
logger.remove()
logger.add(sys.stderr, level="INFO")
logger.add(f"logs/{file_name}.log", rotation=rotation, retention=retention, level="DEBUG")

# Send default logging to loguru
logging.basicConfig(handlers=[InterceptHandler()], level=0)

0 comments on commit 9ebf643

Please sign in to comment.