Better extension log message
This commit is contained in:
parent
080fc78516
commit
f56584b745
3 changed files with 18 additions and 18 deletions
|
@ -63,23 +63,23 @@ async def backup_cmd(ctx: commands.Context):
|
||||||
|
|
||||||
|
|
||||||
def setup(bot: commands.Bot):
|
def setup(bot: commands.Bot):
|
||||||
logger.info(f"Loading of {extension_name} extension")
|
logger.info(f"Loading...")
|
||||||
if not isdir("backup"):
|
if not isdir("backup"):
|
||||||
logger.info(f"Create backup folder")
|
logger.info(f"Create backup folder")
|
||||||
mkdir("backup")
|
mkdir("backup")
|
||||||
try:
|
try:
|
||||||
bot.add_command(backup_cmd)
|
bot.add_command(backup_cmd)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error loading extension {extension_name}: {e}")
|
logger.error(f"Error loading: {e}")
|
||||||
else:
|
else:
|
||||||
logger.info(f"Extension {extension_name} load successful")
|
logger.info(f"Load successful")
|
||||||
|
|
||||||
|
|
||||||
def teardown(bot: commands.Bot):
|
def teardown(bot: commands.Bot):
|
||||||
logger.info(f"Unloading of {extension_name} extension")
|
logger.info(f"Unloading...")
|
||||||
try:
|
try:
|
||||||
bot.remove_command("backup")
|
bot.remove_command("backup")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error unloading extension {extension_name}: {e}")
|
logger.error(f"Error unloading: {e}")
|
||||||
else:
|
else:
|
||||||
logger.info(f"Extension {extension_name} unload successful")
|
logger.info(f"Unload successful")
|
||||||
|
|
|
@ -12,21 +12,21 @@ async def help_cmd(ctx):
|
||||||
|
|
||||||
|
|
||||||
def setup(bot):
|
def setup(bot):
|
||||||
logger.info(f"Loading of {extension_name} extension")
|
logger.info(f"Loading...")
|
||||||
try:
|
try:
|
||||||
bot.help_command = None
|
bot.help_command = None
|
||||||
bot.add_command(help_cmd)
|
bot.add_command(help_cmd)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error loading extension {extension_name}: {e}")
|
logger.error(f"Error loading: {e}")
|
||||||
else:
|
else:
|
||||||
logger.info(f"Extension {extension_name} load successful")
|
logger.info(f"Load successful")
|
||||||
|
|
||||||
|
|
||||||
def teardown(bot):
|
def teardown(bot):
|
||||||
logger.info(f"Unloading of {extension_name} extension")
|
logger.info(f"Unloading...")
|
||||||
try:
|
try:
|
||||||
bot.remove_command("help")
|
bot.remove_command("help")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error unloading extension {extension_name}: {e}")
|
logger.error(f"Error unloading: {e}")
|
||||||
else:
|
else:
|
||||||
logger.info(f"Extension {extension_name} unload successful")
|
logger.info(f"Unload successful")
|
||||||
|
|
|
@ -74,23 +74,23 @@ async def restore_cmd(ctx: commands.Context):
|
||||||
|
|
||||||
|
|
||||||
def setup(bot: commands.Bot):
|
def setup(bot: commands.Bot):
|
||||||
logger.info(f"Loading of {extension_name} extension")
|
logger.info(f"Loading...")
|
||||||
if not isdir("backup"):
|
if not isdir("backup"):
|
||||||
logger.info(f"Create backup folder")
|
logger.info(f"Create backup folder")
|
||||||
mkdir("backup")
|
mkdir("backup")
|
||||||
try:
|
try:
|
||||||
bot.add_command(restore_cmd)
|
bot.add_command(restore_cmd)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error loading extension {extension_name}: {e}")
|
logger.error(f"Error loading: {e}")
|
||||||
else:
|
else:
|
||||||
logger.info(f"Extension {extension_name} load successful")
|
logger.info(f"Load successful")
|
||||||
|
|
||||||
|
|
||||||
def teardown(bot: commands.Bot):
|
def teardown(bot: commands.Bot):
|
||||||
logger.info(f"Unloading of {extension_name} extension")
|
logger.info(f"Unloading...")
|
||||||
try:
|
try:
|
||||||
bot.remove_command("restore")
|
bot.remove_command("restore")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error unloading extension {extension_name}: {e}")
|
logger.error(f"Error unloading: {e}")
|
||||||
else:
|
else:
|
||||||
logger.info(f"Extension {extension_name} unload successful")
|
logger.info(f"Unload successful")
|
||||||
|
|
Reference in a new issue