8181"strip_newline_in_stdout" ,
8282}
8383
84- log = logging .getLogger (__name__ )
85- log .addHandler (logging .NullHandler ())
84+ _logger = logging .getLogger (__name__ )
85+ _logger .addHandler (logging .NullHandler ())
8686
8787__all__ = ("Git" ,)
8888
@@ -146,7 +146,7 @@ def pump_stream(
146146handler (line )
147147
148148except Exception as ex :
149- log .error (f"Pumping{ name !r} of cmd({ remove_password_if_present (cmdline )} ) failed due to:{ ex !r} " )
149+ _logger .error (f"Pumping{ name !r} of cmd({ remove_password_if_present (cmdline )} ) failed due to:{ ex !r} " )
150150if "I/O operation on closed file" not in str (ex ):
151151# Only reraise if the error was not due to the stream closing
152152raise CommandError ([f"<{ name } -pump>" ]+ remove_password_if_present (cmdline ),ex )from ex
@@ -600,7 +600,7 @@ def _terminate(self) -> None:
600600self .status = self ._status_code_if_terminate or proc .poll ()
601601return
602602except OSError as ex :
603- log .info ("Ignored error after process had died: %r" ,ex )
603+ _logger .info ("Ignored error after process had died: %r" ,ex )
604604
605605# It can be that nothing really exists anymore...
606606if os is None or getattr (os ,"kill" ,None )is None :
@@ -613,7 +613,7 @@ def _terminate(self) -> None:
613613
614614self .status = self ._status_code_if_terminate or status
615615except OSError as ex :
616- log .info ("Ignored error after process had died: %r" ,ex )
616+ _logger .info ("Ignored error after process had died: %r" ,ex )
617617# END exception handling
618618
619619def __del__ (self )-> None :
@@ -654,7 +654,7 @@ def read_all_from_possibly_closed_stream(stream: Union[IO[bytes], None]) -> byte
654654
655655if status != 0 :
656656errstr = read_all_from_possibly_closed_stream (p_stderr )
657- log .debug ("AutoInterrupt wait stderr: %r" % (errstr ,))
657+ _logger .debug ("AutoInterrupt wait stderr: %r" % (errstr ,))
658658raise GitCommandError (remove_password_if_present (self .args ),status ,errstr )
659659return status
660660
@@ -1018,7 +1018,7 @@ def execute(
10181018# Remove password for the command if present.
10191019redacted_command = remove_password_if_present (command )
10201020if self .GIT_PYTHON_TRACE and (self .GIT_PYTHON_TRACE != "full" or as_process ):
1021- log .info (" " .join (redacted_command ))
1021+ _logger .info (" " .join (redacted_command ))
10221022
10231023# Allow the user to have the command executed in their working dir.
10241024try :
@@ -1055,7 +1055,7 @@ def execute(
10551055stdout_sink = PIPE if with_stdout else getattr (subprocess ,"DEVNULL" ,None )or open (os .devnull ,"wb" )
10561056if shell is None :
10571057shell = self .USE_SHELL
1058- log .debug (
1058+ _logger .debug (
10591059"Popen(%s, cwd=%s, stdin=%s, shell=%s, universal_newlines=%s)" ,
10601060redacted_command ,
10611061cwd ,
@@ -1167,17 +1167,17 @@ def as_text(stdout_value: Union[bytes, str]) -> str:
11671167# END as_text
11681168
11691169if stderr_value :
1170- log .info (
1170+ _logger .info (
11711171"%s -> %d; stdout: '%s'; stderr: '%s'" ,
11721172cmdstr ,
11731173status ,
11741174as_text (stdout_value ),
11751175safe_decode (stderr_value ),
11761176 )
11771177elif stdout_value :
1178- log .info ("%s -> %d; stdout: '%s'" ,cmdstr ,status ,as_text (stdout_value ))
1178+ _logger .info ("%s -> %d; stdout: '%s'" ,cmdstr ,status ,as_text (stdout_value ))
11791179else :
1180- log .info ("%s -> %d" ,cmdstr ,status )
1180+ _logger .info ("%s -> %d" ,cmdstr ,status )
11811181# END handle debug printing
11821182
11831183if with_exceptions and status != 0 :