feat: enhance logging

- remove `*` from stack log entry
- prefix log messages with arrow symbol for better readability
This commit is contained in:
Sebastian Mark 2023-12-22 22:22:02 +01:00
parent f889ff5050
commit 3bf7fc2255
2 changed files with 12 additions and 8 deletions

View file

@ -16,9 +16,9 @@ def do_selfupdate():
log.error(str(e))
return
if pull_res.old_commit:
log.info("selfupdate: successfully updated myself - exiting")
log.info("SelfUpdate: successfully updated myself - exiting")
sys.exit(0)
log.info("selfupdate: no updates found for myself")
log.info("SelfUpdate: no updates found for myself")
def run_subprocess(command: str, workdir: str) -> bool:
@ -49,11 +49,12 @@ def update_git_repo(repo_path: str, ignore_git_status: bool) -> bool:
Returns:
bool: False if any step fails
"""
# create repo instance if it exists
try:
repo = git.Repo(repo_path)
except git.exc.NoSuchPathError:
log.error("directory not found")
log.error("-> directory not found")
return False
if not ignore_git_status:
@ -61,19 +62,19 @@ def update_git_repo(repo_path: str, ignore_git_status: bool) -> bool:
try:
fetch_res = repo.remotes.origin.fetch()[0]
except git.exc.GitCommandError as e:
log.error(str(e))
log.error("-> " + str(e))
return False
# check for new commits
if not fetch_res.old_commit:
log.info("no changes - skipping")
log.info("-> no changes - skipping")
return False
# pull remote changes to local branch
try:
log.info(repo.git.pull())
log.info("-> " + repo.git.pull())
except git.exc.GitCommandError as e:
log.error(str(e))
log.error("-> " + str(e))
return False
return True