From 6f55c17f48d7608072199496fbcefa33f2e97bf0 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sun, 4 Jan 2015 15:39:28 +0100 Subject: Replaced ordered dict with standard version; used logging module All performance tests still print to stderr, but do so in a py3 compatible way --- git/cmd.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'git/cmd.py') diff --git a/git/cmd.py b/git/cmd.py index d024b409..c355eacf 100644 --- a/git/cmd.py +++ b/git/cmd.py @@ -6,6 +6,7 @@ import os import sys +import logging from util import ( LazyMixin, stream_copy @@ -22,6 +23,8 @@ execute_kwargs = ('istream', 'with_keep_cwd', 'with_extended_output', 'with_exceptions', 'as_process', 'output_stream') +log = logging.getLogger('git.cmd') + __all__ = ('Git', ) @@ -334,7 +337,7 @@ class Git(LazyMixin): If you add additional keyword arguments to the signature of this method, you must update the execute_kwargs tuple housed in this module.""" if self.GIT_PYTHON_TRACE and (self.GIT_PYTHON_TRACE != 'full' or as_process): - print(' '.join(command)) + log.info(' '.join(command)) # Allow the user to have the command executed in their working dir. if with_keep_cwd or self._working_dir is None: @@ -389,11 +392,11 @@ class Git(LazyMixin): if self.GIT_PYTHON_TRACE == 'full': cmdstr = " ".join(command) if stderr_value: - print("%s -> %d; stdout: '%s'; stderr: '%s'" % (cmdstr, status, stdout_value, stderr_value)) + log.info("%s -> %d; stdout: '%s'; stderr: '%s'", cmdstr, status, stdout_value, stderr_value) elif stdout_value: - print("%s -> %d; stdout: '%s'" % (cmdstr, status, stdout_value)) + log.info("%s -> %d; stdout: '%s'", cmdstr, status, stdout_value) else: - print("%s -> %d" % (cmdstr, status)) + log.info("%s -> %d", cmdstr, status) # END handle debug printing if with_exceptions and status != 0: -- cgit v1.2.1