Skip to content

Commit

Permalink
fix: disable logging for gino
Browse files Browse the repository at this point in the history
  • Loading branch information
TimNekk committed Aug 12, 2022
1 parent d8f52f2 commit 3ba9641
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tgbot/misc/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
from datetime import time, timedelta
import sys

import aiogram_broadcaster
import gino
import sqlalchemy
from loguru import logger


Expand All @@ -25,9 +28,9 @@ def emit(self, record: logging.LogRecord) -> None:


def setup(file_name: str = "log", rotation: time = time(), retention: timedelta = timedelta(days=3)) -> None:
# Disable aiogram_broadcaster logging
logging.getLogger("aiogram_broadcaster.text_broadcaster").setLevel(logging.FATAL)
logging.getLogger("aiogram_broadcaster.message_broadcaster").setLevel(logging.FATAL)
# Disable some packages logging
logging.getLogger(aiogram_broadcaster.__name__).setLevel(logging.FATAL)
logging.getLogger(gino.__name__).setLevel(logging.FATAL)

# Setup loguru
logger.remove()
Expand Down

0 comments on commit 3ba9641

Please sign in to comment.