81
81
"strip_newline_in_stdout" ,
82
82
}
83
83
84
- log = logging .getLogger (__name__ )
85
- log .addHandler (logging .NullHandler ())
84
+ _logger = logging .getLogger (__name__ )
85
+ _logger .addHandler (logging .NullHandler ())
86
86
87
87
__all__ = ("Git" ,)
88
88
@@ -146,7 +146,7 @@ def pump_stream(
146
146
handler (line )
147
147
148
148
except 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} " )
150
150
if "I/O operation on closed file" not in str (ex ):
151
151
# Only reraise if the error was not due to the stream closing
152
152
raise CommandError ([f"<{ name } -pump>" ] + remove_password_if_present (cmdline ), ex ) from ex
@@ -600,7 +600,7 @@ def _terminate(self) -> None:
600
600
self .status = self ._status_code_if_terminate or proc .poll ()
601
601
return
602
602
except 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 )
604
604
605
605
# It can be that nothing really exists anymore...
606
606
if os is None or getattr (os , "kill" , None ) is None :
@@ -613,7 +613,7 @@ def _terminate(self) -> None:
613
613
614
614
self .status = self ._status_code_if_terminate or status
615
615
except 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 )
617
617
# END exception handling
618
618
619
619
def __del__ (self ) -> None :
@@ -654,7 +654,7 @@ def read_all_from_possibly_closed_stream(stream: Union[IO[bytes], None]) -> byte
654
654
655
655
if status != 0 :
656
656
errstr = read_all_from_possibly_closed_stream (p_stderr )
657
- log .debug ("AutoInterrupt wait stderr: %r" % (errstr ,))
657
+ _logger .debug ("AutoInterrupt wait stderr: %r" % (errstr ,))
658
658
raise GitCommandError (remove_password_if_present (self .args ), status , errstr )
659
659
return status
660
660
@@ -1018,7 +1018,7 @@ def execute(
1018
1018
# Remove password for the command if present.
1019
1019
redacted_command = remove_password_if_present (command )
1020
1020
if 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 ))
1022
1022
1023
1023
# Allow the user to have the command executed in their working dir.
1024
1024
try :
@@ -1055,7 +1055,7 @@ def execute(
1055
1055
stdout_sink = PIPE if with_stdout else getattr (subprocess , "DEVNULL" , None ) or open (os .devnull , "wb" )
1056
1056
if shell is None :
1057
1057
shell = self .USE_SHELL
1058
- log .debug (
1058
+ _logger .debug (
1059
1059
"Popen(%s, cwd=%s, stdin=%s, shell=%s, universal_newlines=%s)" ,
1060
1060
redacted_command ,
1061
1061
cwd ,
@@ -1167,17 +1167,17 @@ def as_text(stdout_value: Union[bytes, str]) -> str:
1167
1167
# END as_text
1168
1168
1169
1169
if stderr_value :
1170
- log .info (
1170
+ _logger .info (
1171
1171
"%s -> %d; stdout: '%s'; stderr: '%s'" ,
1172
1172
cmdstr ,
1173
1173
status ,
1174
1174
as_text (stdout_value ),
1175
1175
safe_decode (stderr_value ),
1176
1176
)
1177
1177
elif 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 ))
1179
1179
else :
1180
- log .info ("%s -> %d" , cmdstr , status )
1180
+ _logger .info ("%s -> %d" , cmdstr , status )
1181
1181
# END handle debug printing
1182
1182
1183
1183
if with_exceptions and status != 0 :
0 commit comments