Skip to content

Commit

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

import aiogram_broadcaster
import gino
from loguru import logger


Expand All @@ -25,9 +27,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 1e7dec6

Please sign in to comment.