8181 "strip_newline_in_stdout" ,
8282}
8383
84- log = logging .getLogger (__name__ )
85- log .addHandler (logging .NullHandler ())
84+ _logger = logging .getLogger (__name__ )
8685
8786__all__ = ("Git" ,)
8887
@@ -146,7 +145,7 @@ def pump_stream(
146145 handler (line )
147146
148147 except Exception as ex :
149- log .error (f"Pumping { name !r} of cmd({ remove_password_if_present (cmdline )} ) failed due to: { ex !r} " )
148+ _logger .error (f"Pumping { name !r} of cmd({ remove_password_if_present (cmdline )} ) failed due to: { ex !r} " )
150149 if "I/O operation on closed file" not in str (ex ):
151150 # Only reraise if the error was not due to the stream closing
152151 raise CommandError ([f"<{ name } -pump>" ] + remove_password_if_present (cmdline ), ex ) from ex
@@ -600,7 +599,7 @@ def _terminate(self) -> None:
600599 self .status = self ._status_code_if_terminate or proc .poll ()
601600 return
602601 except OSError as ex :
603- log .info ("Ignored error after process had died: %r" , ex )
602+ _logger .info ("Ignored error after process had died: %r" , ex )
604603
605604 # It can be that nothing really exists anymore...
606605 if os is None or getattr (os , "kill" , None ) is None :
@@ -613,7 +612,7 @@ def _terminate(self) -> None:
613612
614613 self .status = self ._status_code_if_terminate or status
615614 except OSError as ex :
616- log .info ("Ignored error after process had died: %r" , ex )
615+ _logger .info ("Ignored error after process had died: %r" , ex )
617616 # END exception handling
618617
619618 def __del__ (self ) -> None :
@@ -654,7 +653,7 @@ def read_all_from_possibly_closed_stream(stream: Union[IO[bytes], None]) -> byte
654653
655654 if status != 0 :
656655 errstr = read_all_from_possibly_closed_stream (p_stderr )
657- log .debug ("AutoInterrupt wait stderr: %r" % (errstr ,))
656+ _logger .debug ("AutoInterrupt wait stderr: %r" % (errstr ,))
658657 raise GitCommandError (remove_password_if_present (self .args ), status , errstr )
659658 return status
660659
@@ -1018,7 +1017,7 @@ def execute(
10181017 # Remove password for the command if present.
10191018 redacted_command = remove_password_if_present (command )
10201019 if self .GIT_PYTHON_TRACE and (self .GIT_PYTHON_TRACE != "full" or as_process ):
1021- log .info (" " .join (redacted_command ))
1020+ _logger .info (" " .join (redacted_command ))
10221021
10231022 # Allow the user to have the command executed in their working dir.
10241023 try :
@@ -1055,7 +1054,7 @@ def execute(
10551054 stdout_sink = PIPE if with_stdout else getattr (subprocess , "DEVNULL" , None ) or open (os .devnull , "wb" )
10561055 if shell is None :
10571056 shell = self .USE_SHELL
1058- log .debug (
1057+ _logger .debug (
10591058 "Popen(%s, cwd=%s, stdin=%s, shell=%s, universal_newlines=%s)" ,
10601059 redacted_command ,
10611060 cwd ,
@@ -1167,17 +1166,17 @@ def as_text(stdout_value: Union[bytes, str]) -> str:
11671166 # END as_text
11681167
11691168 if stderr_value :
1170- log .info (
1169+ _logger .info (
11711170 "%s -> %d; stdout: '%s'; stderr: '%s'" ,
11721171 cmdstr ,
11731172 status ,
11741173 as_text (stdout_value ),
11751174 safe_decode (stderr_value ),
11761175 )
11771176 elif stdout_value :
1178- log .info ("%s -> %d; stdout: '%s'" , cmdstr , status , as_text (stdout_value ))
1177+ _logger .info ("%s -> %d; stdout: '%s'" , cmdstr , status , as_text (stdout_value ))
11791178 else :
1180- log .info ("%s -> %d" , cmdstr , status )
1179+ _logger .info ("%s -> %d" , cmdstr , status )
11811180 # END handle debug printing
11821181
11831182 if with_exceptions and status != 0 :
0 commit comments