Skip to content

Commit d406ee1

Browse files
Feat/logging format (#44)
* Configure logging format
1 parent 1bba37e commit d406ee1

2 files changed

Lines changed: 6 additions & 12 deletions

File tree

gitopscli/__main__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010

1111

1212
def main():
13-
logging.basicConfig(level=logging.INFO)
14-
13+
logging.basicConfig(level=logging.INFO, format="%(levelname)-2s %(funcName)s: %(message)s")
1514
args = create_cli()
1615

1716
if args.command == "deploy":

gitopscli/commands/create_preview.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ def create_preview_command(
4444
)
4545

4646
apps_git.checkout(branch)
47-
logging.info("App repo %s checkout successfull", branch)
47+
logging.info("App repo branch %s checkout successful", branch)
4848
shortened_branch_hash = hashlib.sha256(branch.encode("utf-8")).hexdigest()[:8]
49-
logging.info("Hashed branch %s to hash %s", branch, shortened_branch_hash)
49+
logging.info("Hashed branch %s to hash: %s", branch, shortened_branch_hash)
5050
gitops_config = GitOpsConfig(apps_git.get_full_file_path(".gitops.config.yaml"))
5151
logging.info("Read GitOpsConfig: %s", gitops_config)
5252

@@ -62,7 +62,7 @@ def create_preview_command(
6262
root_tmp_dir,
6363
)
6464
root_git.checkout("master")
65-
logging.info("Config repo master checkout successful")
65+
logging.info("Config repo branch master checkout successful")
6666
root_git.new_branch(branch)
6767
logging.info("Created branch %s in config repo", branch)
6868
preview_template_folder_name = ".preview-templates/" + gitops_config.application_name
@@ -92,14 +92,9 @@ def create_preview_command(
9292
root_git.push(branch)
9393
logging.info("Pushed branch %s", branch)
9494
pr_comment_text = f"""
95-
Preview created successfully. Access it [here](https://{route_host}).
95+
Preview created successfully. Access it here: https://{route_host}.
9696
"""
97-
logging.info(
98-
"Creating PullRequest comment for pr with id %s and parentComment with id %s and content: %s",
99-
pr_id,
100-
pr_comment_text,
101-
parent_id,
102-
)
97+
logging.info("Creating PullRequest comment for pr with id %s and content: %s", pr_id, pr_comment_text)
10398
apps_git.add_pull_request_comment(pr_id, pr_comment_text, parent_id)
10499
finally:
105100
shutil.rmtree(apps_tmp_dir, ignore_errors=True)

0 commit comments

Comments
 (0)