[FIX] fix duplicated logging #28

This commit is contained in:
Benedek Racz 2020-03-30 09:05:36 +02:00
parent fff4281702
commit 08e2ffa109
4 changed files with 8 additions and 6 deletions

4
.gitignore vendored
View File

@ -1,3 +1,5 @@
test_01_installed/*
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
@ -42,7 +44,7 @@ pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage*
.cache
nosetests.xml
coverage.xml

View File

@ -42,8 +42,6 @@ default_port = 4321
#
logger = logging.getLogger('wexpect')
init_logger(logger)
class ConsoleReaderBase:
"""Consol class (aka. client-side python class) for the child.

View File

@ -65,8 +65,6 @@ from .wexpect_util import SIGNAL_CHARS
logger = logging.getLogger('wexpect')
init_logger(logger)
def run(command, timeout=-1, withexitstatus=False, events=None, extra_args=None, logfile=None,
cwd=None, env=None, **kwargs):

View File

@ -36,7 +36,9 @@ def spam(self, message, *args, **kws):
logging.Logger.spam = spam
def init_logger(logger):
def init_logger(logger=None):
if logger is None:
logger = logging.getLogger('wexpect')
try:
logger_level = os.environ['WEXPECT_LOGGER_LEVEL']
try:
@ -160,3 +162,5 @@ class EOF(ExceptionPexpect):
class TIMEOUT(ExceptionPexpect):
"""Raised when a read time exceeds the timeout. """
init_logger()