Skip to content

Commit 244d215

Browse files
committed
Add logging to base file
1 parent 112e03b commit 244d215

File tree

14 files changed

+104
-30
lines changed

14 files changed

+104
-30
lines changed

app/cli.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
1+
import logging
2+
import sys
3+
14
import click
25
import requests
36

47
from app.commands import check, download, progress, setup, verify
58
from app.commands.version import version
6-
from app.utils.click_utils import warn
7-
from app.utils.version_utils import Version
9+
from app.utils.click import warn
10+
from app.utils.version import Version
811
from app.version import __version__
912

1013

11-
@click.group()
14+
class LoggingGroup(click.Group):
15+
def invoke(self, ctx: click.Context) -> None:
16+
logger = logging.getLogger(__name__)
17+
logger.info("Running command %s with arguments %s", ctx.command_path, sys.argv)
18+
return super().invoke(ctx)
19+
20+
21+
@click.group(cls=LoggingGroup)
1222
@click.option("--verbose", "-v", is_flag=True, help="Enable verbose output")
1323
@click.pass_context
1424
def cli(ctx, verbose) -> None:

app/commands/check/git.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import click
22

33
from app.commands.check.github import github
4-
from app.utils.click_utils import error, info, success
5-
from app.utils.gh_cli_utils import is_authenticated, is_github_cli_installed
6-
from app.utils.git_cli_utils import get_git_config, is_git_installed
4+
from app.utils.click import error, info, success
5+
from app.utils.gh_cli import is_authenticated, is_github_cli_installed
6+
from app.utils.git_cli import get_git_config, is_git_installed
77

88

99
@click.command()

app/commands/check/github.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import click
22

3-
from app.utils.click_utils import error, info, success
4-
from app.utils.gh_cli_utils import is_authenticated, is_github_cli_installed
5-
from app.utils.git_cli_utils import get_git_config, is_git_installed
3+
from app.utils.click import error, info, success
4+
from app.utils.gh_cli import is_authenticated, is_github_cli_installed
5+
from app.utils.git_cli import get_git_config, is_git_installed
66

77

88
@click.command()

app/commands/progress/reset.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
from app.commands.check.github import github
1212
from app.commands.download import setup_exercise_folder
1313
from app.commands.progress.constants import STUDENT_PROGRESS_FORK_NAME
14-
from app.utils.click_utils import error, info, success, warn
15-
from app.utils.gh_cli_utils import delete_repo, get_username
16-
from app.utils.gitmastery_utils import (
14+
from app.utils.click import error, info, success, warn
15+
from app.utils.gh_cli import delete_repo, get_username
16+
from app.utils.gitmastery import (
1717
generate_cds_string,
1818
require_gitmastery_exercise_root,
1919
require_gitmastery_root,

app/commands/progress/sync/off.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
from app.commands.check.git import git
77
from app.commands.check.github import github
88
from app.commands.progress.constants import STUDENT_PROGRESS_FORK_NAME
9-
from app.utils.click_utils import confirm, error, info
10-
from app.utils.gh_cli_utils import delete_repo, get_username
11-
from app.utils.gitmastery_utils import generate_cds_string, require_gitmastery_root
9+
from app.utils.click import confirm, error, info
10+
from app.utils.gh_cli import delete_repo, get_username
11+
from app.utils.gitmastery import generate_cds_string, require_gitmastery_root
1212

1313

1414
@click.command()

app/commands/progress/sync/on.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@
1111
PROGRESS_REPOSITORY_NAME,
1212
STUDENT_PROGRESS_FORK_NAME,
1313
)
14-
from app.utils.click_utils import error, info, success, warn
15-
from app.utils.gh_cli_utils import (
14+
from app.utils.click import error, info, success, warn
15+
from app.utils.gh_cli import (
1616
clone_with_custom_name,
1717
fork,
1818
get_prs,
1919
get_username,
2020
has_fork,
2121
pull_request,
2222
)
23-
from app.utils.git_cli_utils import add_all, add_remote, commit, push
24-
from app.utils.gitmastery_utils import (
23+
from app.utils.git_cli import add_all, add_remote, commit, push
24+
from app.utils.gitmastery import (
2525
GITMASTERY_CONFIG_NAME,
2626
generate_cds_string,
2727
require_gitmastery_root,

app/commands/setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66
from app.commands.check.git import git
77
from app.commands.progress.constants import PROGRESS_REPOSITORY_NAME
8-
from app.utils.click_utils import error, info, prompt
9-
from app.utils.gh_cli_utils import clone
10-
from app.utils.git_cli_utils import remove_remote
8+
from app.utils.click import error, info, prompt
9+
from app.utils.gh_cli import clone
10+
from app.utils.git_cli import remove_remote
1111

1212

1313
@click.command()

app/commands/verify.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
LOCAL_FOLDER_NAME,
1818
PROGRESS_REPOSITORY_NAME,
1919
)
20-
from app.utils.click_utils import error, info, warn
21-
from app.utils.gh_cli_utils import get_prs, get_username, pull_request
22-
from app.utils.git_cli_utils import add_all, commit, push
23-
from app.utils.gitmastery_utils import (
20+
from app.utils.click import error, info, warn
21+
from app.utils.gh_cli import get_prs, get_username, pull_request
22+
from app.utils.git_cli import add_all, commit, push
23+
from app.utils.gitmastery import (
2424
execute_py_file_function_from_url,
2525
require_gitmastery_exercise_root,
2626
require_gitmastery_root,

app/commands/version.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import click
22

3-
from app.utils.click_utils import info
4-
from app.utils.version_utils import Version
3+
from app.utils.click import info
4+
from app.utils.version import Version
55
from app.version import __version__
66

77

app/logging/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)