Archived
1
0
Fork 0

Better extension log message

This commit is contained in:
Ethanell 2020-03-28 14:07:30 +01:00
parent 080fc78516
commit f56584b745
3 changed files with 18 additions and 18 deletions

View file

@ -63,23 +63,23 @@ async def backup_cmd(ctx: commands.Context):
def setup(bot: commands.Bot):
logger.info(f"Loading of {extension_name} extension")
logger.info(f"Loading...")
if not isdir("backup"):
logger.info(f"Create backup folder")
mkdir("backup")
try:
bot.add_command(backup_cmd)
except Exception as e:
logger.error(f"Error loading extension {extension_name}: {e}")
logger.error(f"Error loading: {e}")
else:
logger.info(f"Extension {extension_name} load successful")
logger.info(f"Load successful")
def teardown(bot: commands.Bot):
logger.info(f"Unloading of {extension_name} extension")
logger.info(f"Unloading...")
try:
bot.remove_command("backup")
except Exception as e:
logger.error(f"Error unloading extension {extension_name}: {e}")
logger.error(f"Error unloading: {e}")
else:
logger.info(f"Extension {extension_name} unload successful")
logger.info(f"Unload successful")

View file

@ -12,21 +12,21 @@ async def help_cmd(ctx):
def setup(bot):
logger.info(f"Loading of {extension_name} extension")
logger.info(f"Loading...")
try:
bot.help_command = None
bot.add_command(help_cmd)
except Exception as e:
logger.error(f"Error loading extension {extension_name}: {e}")
logger.error(f"Error loading: {e}")
else:
logger.info(f"Extension {extension_name} load successful")
logger.info(f"Load successful")
def teardown(bot):
logger.info(f"Unloading of {extension_name} extension")
logger.info(f"Unloading...")
try:
bot.remove_command("help")
except Exception as e:
logger.error(f"Error unloading extension {extension_name}: {e}")
logger.error(f"Error unloading: {e}")
else:
logger.info(f"Extension {extension_name} unload successful")
logger.info(f"Unload successful")

View file

@ -74,23 +74,23 @@ async def restore_cmd(ctx: commands.Context):
def setup(bot: commands.Bot):
logger.info(f"Loading of {extension_name} extension")
logger.info(f"Loading...")
if not isdir("backup"):
logger.info(f"Create backup folder")
mkdir("backup")
try:
bot.add_command(restore_cmd)
except Exception as e:
logger.error(f"Error loading extension {extension_name}: {e}")
logger.error(f"Error loading: {e}")
else:
logger.info(f"Extension {extension_name} load successful")
logger.info(f"Load successful")
def teardown(bot: commands.Bot):
logger.info(f"Unloading of {extension_name} extension")
logger.info(f"Unloading...")
try:
bot.remove_command("restore")
except Exception as e:
logger.error(f"Error unloading extension {extension_name}: {e}")
logger.error(f"Error unloading: {e}")
else:
logger.info(f"Extension {extension_name} unload successful")
logger.info(f"Unload successful")