forked from blizzthewolf/SeaCogs
feat(backup): added more verbose logging
This commit is contained in:
parent
756265503c
commit
a00bfc3f93
1 changed files with 11 additions and 2 deletions
|
@ -83,6 +83,9 @@ class Backup(commands.Cog):
|
|||
await ctx.send(error(f"You do not have the `Downloader` cog loaded. Please run `{ctx.prefix}load downloader` and try again."))
|
||||
return
|
||||
|
||||
repo_s = []
|
||||
uninstall_s = []
|
||||
install_s = []
|
||||
repo_e = []
|
||||
uninstall_e = []
|
||||
install_e = []
|
||||
|
@ -107,6 +110,7 @@ class Backup(commands.Cog):
|
|||
|
||||
try:
|
||||
repository = await downloader._repo_manager.add_repo(url, name, branch) # pylint: disable=protected-access
|
||||
repo_s.append(f"Added repository {name} from {url} on branch {branch}.")
|
||||
|
||||
except errors.ExistingGitRepo:
|
||||
repo_e.append(f"Repository {name} already exists.")
|
||||
|
@ -160,6 +164,7 @@ class Backup(commands.Cog):
|
|||
await ctx.bot.unload_extension(cog)
|
||||
await ctx.bot.remove_loaded_package(cog)
|
||||
await downloader._delete_cog(poss_installed_path) # pylint: disable=protected-access
|
||||
uninstall_s.append(f"Uninstalled {cog}")
|
||||
else:
|
||||
uninstall_e.append(f"Failed to uninstall {cog}")
|
||||
await downloader._remove_from_installed(cog_modules) # pylint: disable=protected-access
|
||||
|
@ -174,7 +179,7 @@ class Backup(commands.Cog):
|
|||
|
||||
async with repository.checkout(commit, exit_to_rev=repository.branch):
|
||||
cogs_c, message = await downloader._filter_incorrect_cogs_by_names(repository, [cog_name]) # pylint: disable=protected-access
|
||||
if not cogs:
|
||||
if not cogs_c:
|
||||
install_e.append(message)
|
||||
continue
|
||||
failed_reqs = await downloader._install_requirements(cogs_c) # pylint: disable=protected-access
|
||||
|
@ -195,8 +200,12 @@ class Backup(commands.Cog):
|
|||
cog.pinned = True
|
||||
|
||||
await downloader._save_to_installed(installed_cogs + installed_libs if installed_libs else installed_cogs) # pylint: disable=protected-access
|
||||
if installed_cogs:
|
||||
install_s.append(f"Installed {installed_cogs}")
|
||||
if installed_libs:
|
||||
install_s.append(f"Installed {installed_libs} required for {cog_name}")
|
||||
if failed_cogs:
|
||||
install_e.append(f"Failed to install {failed_cogs}")
|
||||
if failed_libs:
|
||||
install_e.append(f"Failed to install {failed_libs} required for {cog_name}")
|
||||
await ctx.send("Import complete!\nErrors:", file=text_to_file(f"Repositories:\n{repo_e}\n\nUninstalled Cogs:\n{uninstall_e}\n\nInstalled Cogs:\n{install_e}", 'backup-errors.log'))
|
||||
await ctx.send("Import complete!", file=text_to_file(f"Repositories:\n{repo_s}\n\nRepository Errors:\n{repo_e}\n\nUninstalled Cogs:\n{uninstall_s}\n\nUninstalled Cogs Errors:\n{uninstall_e}\n\nInstalled Cogs:\n{install_s}\n\nInstalled Cogs Errors:{install_e}", 'backup.log'))
|
||||
|
|
Loading…
Reference in a new issue