Simplify logger setup

This commit is contained in:
2025-08-10 07:41:41 -07:00
parent 0a5dcc6701
commit 13e1a983d9
2 changed files with 3 additions and 7 deletions

View File

@@ -1,10 +1,10 @@
{ {
"401095ca": { "401095ca": {
"channel_id": "1392730642206429307", "channel_id": "1392730642206429307",
"message_id": "1404091156421279935" "message_id": "1404111932625260566"
}, },
"548c4f18": { "548c4f18": {
"channel_id": "1392730682576343121", "channel_id": "1392730682576343121",
"message_id": "1404091162607747135" "message_id": "1404111938975432725"
} }
} }

View File

@@ -16,7 +16,6 @@ Features:
import discord import discord
from discord.ext import commands, tasks from discord.ext import commands, tasks
from discord import app_commands from discord import app_commands
import os
import aiohttp import aiohttp
import asyncio import asyncio
import json import json
@@ -33,15 +32,12 @@ import generate_config
# LOGGING SETUP # LOGGING SETUP
# ============================================== # ==============================================
logs_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'logs')
os.makedirs(logs_dir, exist_ok=True)
logger = logging.getLogger('pterodisbot') logger = logging.getLogger('pterodisbot')
logger.setLevel(logging.DEBUG) logger.setLevel(logging.DEBUG)
# File handler for logs (rotates when reaching 5MB, keeps 3 backups) # File handler for logs (rotates when reaching 5MB, keeps 3 backups)
handler = RotatingFileHandler( handler = RotatingFileHandler(
filename=os.path.join(logs_dir, 'pterodisbot.log'), './logs/pterodisbot.log',
maxBytes=5*1024*1024, # 5 MiB max log file size maxBytes=5*1024*1024, # 5 MiB max log file size
backupCount=3, # Rotate through 3 files backupCount=3, # Rotate through 3 files
encoding='utf-8' encoding='utf-8'