Skip to content

Commit

Permalink
fix: site access is debug level now
Browse files Browse the repository at this point in the history
  • Loading branch information
Zalk0 committed Nov 13, 2024
1 parent 08d2ade commit 22d8f29
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions chouette/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,17 @@ async def start_server(self) -> None:
"""Démarre un serveur HTTP pour vérifier si le bot est en ligne."""
# Set a logger for the webserver
web_logger = logging.getLogger("web")
# Don't want to spam logs with site access
if self.log_level >= logging.INFO:
logging.getLogger("aiohttp.access").setLevel(logging.ERROR)

# Switch site access log to DEBUG level
def access_filter(record: logging.LogRecord) -> bool:
if record.levelno == logging.INFO:
if self.log_level >= logging.INFO:
return False
record.levelno = logging.DEBUG
record.levelname = "DEBUG"
return True

logging.getLogger("aiohttp.access").addFilter(access_filter)

# Set some basic headers for security
headers = {
Expand Down

0 comments on commit 22d8f29

Please sign in to comment.