add log.py and set logger handlers correctly in all files.

This commit is contained in:
2021-08-11 20:02:47 +02:00
parent 6e5d8261ff
commit 2d69abbd37
8 changed files with 67 additions and 56 deletions

View File

@@ -5,10 +5,16 @@ from discord.ext import commands
from jeevesbot import env
import os
import log
import logging.config
from logging import getLogger
# setup root logger handlers
logging.config.dictConfig(log.LOGGING)
# setup logging
logger = log.get_logger(__name__)
log = getLogger(__name__)
# setup discord.py bot
@@ -21,14 +27,14 @@ e = discord.Embed()
@commands.has_permissions(administrator=True)
async def load(ctx, extension):
bot.load_extension(f'cogs.{extension}')
print(extension, 'module loaded')
log.info(f'{extension} module loaded')
@bot.command()
@commands.has_permissions(administrator=True)
async def unload(ctx, extension):
bot.unload_extension(f'cogs.{extension}')
print(extension, 'module unloaded')
log.info(f'{extension} module unloaded')
@bot.command()
@@ -36,7 +42,7 @@ async def unload(ctx, extension):
async def reload(ctx, extension):
bot.unload_extension(f'cogs.{extension}')
bot.load_extension(f'cogs.{extension}')
print(extension, 'module reloaded')
log.info(f'{extension} module reloaded')
@bot.event