Skip to content

Commit

Permalink
Add general INFO logging to commands.
Browse files Browse the repository at this point in the history
  • Loading branch information
elibon99 committed Dec 20, 2023
1 parent a898f5a commit e3b380a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions gitbark/cli/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ def add_rules(ctx):
"Please commit the changes!"
),
)
logger.info("Commit rules added successfully")
click.echo("Commit rules configuration was committed successfully!")


Expand All @@ -150,6 +151,7 @@ def add_modules(ctx):
),
)
checkout_or_orphan(project, branch)
logger.info("Bark modules added successfully")
click.echo("Bark modules configuration was committed successfully!")


Expand All @@ -172,6 +174,7 @@ def protect(ctx):
),
)
checkout_or_orphan(project, branch)
logger.info(f"'{branch}' added to 'bark_rules' successfully")
click.echo("Bark modules configuration was committed successfully!")


Expand All @@ -194,6 +197,7 @@ def install(ctx):

try:
install_cmd(project)
logger.info("Hooks installed successfully")
click.echo("Installed GitBark successfully!")
except RuleViolation as e:
pp_violation(e)
Expand Down Expand Up @@ -233,6 +237,10 @@ def ref_update(ctx, old, new, ref):
verify_ref_update(project, ref, head)
if os.path.exists(fail_head):
os.remove(fail_head)
# TODO: Need to enable logging through env variable
logger.info(
f"Reference update ({old}->{new}) on {ref} " "validated successfully"
)
except RuleViolation as e:
with open(fail_head, "w") as f:
f.write(head.hash.hex())
Expand Down
4 changes: 4 additions & 0 deletions gitbark/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
import os
import sys
import re
import logging

logger = logging.getLogger(__name__)


class PROJECT_FILES(str, Enum):
Expand Down Expand Up @@ -110,6 +113,7 @@ def install_modules(self, requirements: bytes) -> None:
with open(r_file, "wb") as f:
f.write(requirements)

logger.debug("Installing modules")
pip_path = os.path.join(self.env_path, "bin", "pip")
cmd(pip_path, "install", "-r", r_file)

Expand Down

0 comments on commit e3b380a

Please sign in to comment.