diff options
-rw-r--r-- | git_deps/detector.py | 11 | ||||
-rw-r--r-- | git_deps/utils.py | 7 |
2 files changed, 10 insertions, 8 deletions
diff --git a/git_deps/detector.py b/git_deps/detector.py index 8f50d2c..1f470ee 100644 --- a/git_deps/detector.py +++ b/git_deps/detector.py @@ -3,7 +3,7 @@ import subprocess import pygit2 -from git_deps.utils import abort, debug_logger +from git_deps.utils import abort, standard_logger from git_deps.listener.base import DependencyListener from git_deps.errors import InvalidCommitish @@ -23,7 +23,8 @@ class DependencyDetector(object): self.options = options if logger is None: - self.logger = self.default_logger() + self.logger = standard_logger(self.__class__.__name__, + options.debug) if repo_path is None: try: @@ -71,12 +72,6 @@ class DependencyDetector(object): fn = getattr(listener, event) fn(*args) - def default_logger(self): - if not self.options.debug: - return logging.getLogger(self.__class__.__name__) - - return debug_logger(self.__class__.__name__) - def seen_commit(self, rev): return rev in self.commits diff --git a/git_deps/utils.py b/git_deps/utils.py index e2e1720..cd2a0f1 100644 --- a/git_deps/utils.py +++ b/git_deps/utils.py @@ -9,6 +9,13 @@ def abort(msg, exitcode=1): sys.exit(exitcode) +def standard_logger(name, debug): + if not debug: + return logging.getLogger(name) + + return debug_logger(name) + + def debug_logger(name): log_format = '%(asctime)-15s %(levelname)-6s %(message)s' date_format = '%b %d %H:%M:%S' |