diff --git a/README.rst b/README.rst index 194fe74..50f7504 100644 --- a/README.rst +++ b/README.rst @@ -114,7 +114,7 @@ Creation from scratch: password='password', # type: typing.Optional[str] key=None, # type: typing.Optional[paramiko.RSAKey] keys=None, # type: typing.Optional[typing.Iterable[paramiko.RSAKey]], - key_filename=None, # type: typing.Union[typing.List[str], str, None] + key_filename=None, # type: typing.Union[typing.List[str], None] passphrase=None, # type: typing.Optional[str] ) diff --git a/doc/source/Subprocess.rst b/doc/source/Subprocess.rst index f4de489..0a75b5b 100644 --- a/doc/source/Subprocess.rst +++ b/doc/source/Subprocess.rst @@ -8,14 +8,12 @@ API: Subprocess .. py:class:: Subprocess() - .. py:method:: __init__(logger, log_mask_re=None, *, logger=logging.getLogger("exec_helpers.subprocess_runner")) + .. py:method:: __init__(logger, log_mask_re=None) ExecHelper global API. :param log_mask_re: regex lookup rule to mask command for logger. all MATCHED groups will be replaced by '<*masked*>' :type log_mask_re: typing.Optional[str] - :param logger: logger instance to use - :type logger: logging.Logger .. versionchanged:: 1.2.0 log_mask_re regex rule for masking cmd .. versionchanged:: 3.1.0 Not singleton anymore. Only lock is shared between all instances. diff --git a/exec_helpers/_ssh_client_base.py b/exec_helpers/_ssh_client_base.py index d80fed7..72d0bac 100644 --- a/exec_helpers/_ssh_client_base.py +++ b/exec_helpers/_ssh_client_base.py @@ -283,8 +283,9 @@ def __init__( real_auth = self.__auth_mapping[self.hostname] # Init super with host and real port and username + mod_name = "exec_helpers" if self.__module__.startswith("exec_helpers") else self.__module__ super(SSHClientBase, self).__init__( - logger=logging.getLogger(f"{self.__module__}.{self.__class__.__name__}").getChild( + logger=logging.getLogger(f"{mod_name}.{self.__class__.__name__}").getChild( f"({real_auth.username}@{host}:{self.__port})" ) ) diff --git a/exec_helpers/subprocess_runner.py b/exec_helpers/subprocess_runner.py index a65d915..5ed526d 100644 --- a/exec_helpers/subprocess_runner.py +++ b/exec_helpers/subprocess_runner.py @@ -65,12 +65,7 @@ def stdout(self) -> "typing.Optional[typing.IO[bytes]]": # type: ignore class Subprocess(api.ExecHelper): """Subprocess helper with timeouts and lock-free FIFO.""" - def __init__( - self, - log_mask_re: typing.Optional[str] = None, - *, - logger: logging.Logger = logging.getLogger(__name__), # noqa: B008 - ) -> None: + def __init__(self, log_mask_re: typing.Optional[str] = None,) -> None: """Subprocess helper with timeouts and lock-free FIFO. For excluding race-conditions we allow to run 1 command simultaneously @@ -78,8 +73,6 @@ def __init__( :param log_mask_re: regex lookup rule to mask command for logger. all MATCHED groups will be replaced by '<*masked*>' :type log_mask_re: typing.Optional[str] - :param logger: logger instance to use - :type logger: logging.Logger .. versionchanged:: 1.2.0 log_mask_re regex rule for masking cmd .. versionchanged:: 3.1.0 Not singleton anymore. Only lock is shared between all instances. @@ -87,7 +80,10 @@ def __init__( .. versionchanged:: 4.1.0 support chroot .. versionchanged:: 4.3.0 Lock is not shared anymore: allow parallel call of different instances. """ - super(Subprocess, self).__init__(logger=logger, log_mask_re=log_mask_re) + mod_name = "exec_helpers" if self.__module__.startswith("exec_helpers") else self.__module__ + super(Subprocess, self).__init__( + logger=logging.getLogger(f"{mod_name}.{self.__class__.__name__}"), log_mask_re=log_mask_re + ) def _exec_command( # type: ignore self,