Skip to content

Commit

Permalink
Really basic logging
Browse files Browse the repository at this point in the history
  • Loading branch information
sahansk2 committed Aug 27, 2020
1 parent 4f1cd08 commit 25cbd2e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions gitgud/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@

import sys
import subprocess
import logging.config

from git import Actor

actor = Actor("Git Gud", "[email protected]")
actor_string = "Git Gud <[email protected]>"


logging.basicConfig(stream=sys.stdout, level=logging.INFO)


def create_alias():
# Git uses unix-like path separators
python = sys.executable.replace('\\', '/')
Expand Down
6 changes: 4 additions & 2 deletions gitgud/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import argparse

import gitgud
from gitgud import logging
from gitgud.operations import Operator, get_operator
from gitgud.skills import all_skills
from gitgud.skills.user_messages import all_levels_complete
Expand All @@ -13,6 +14,7 @@
from gitgud.skills.user_messages import handle_solution_confirmation
from gitgud.skills.user_messages import show_skill_tree

log=logging.getLogger(__name__)

class InitializationError(Exception):
pass
Expand Down Expand Up @@ -301,7 +303,7 @@ def handle_init(self, args):
print('{} will be left as is.'.format(file_operator.gg_path)) # noqa: E501
return
else:
print('Force initializing Git Gud.')
log.info('Force initializing Git Gud.')
elif len(list(Path.cwd().iterdir())) != 0:
if not (args.force and args.prettyplease):
print('Current directory is nonempty. Initializing will delete all files.') # noqa: E501
Expand All @@ -325,7 +327,7 @@ def handle_status(self, args):
level.status()
except KeyError:
level_name = get_operator().read_level_file()
print('Currently on unregistered level: "{}"'
log.error('Currently on unregistered level: "{}"'
.format(level_name))
else:
print("Git Gud not initialized.")
Expand Down

0 comments on commit 25cbd2e

Please sign in to comment.