Skip to content

Commit 34f18a2

Browse files
author
Dan
committed
Updated pssh.utils.enable_logger to be more compatible with py 2.6. Cleanup
1 parent 1f431b2 commit 34f18a2

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

examples/pssh_local.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
utils.enable_host_logger()
2828
utils.enable_logger(utils.logger)
29-
29+
3030
def test():
3131
"""Perform ls and copy file with SSHClient on localhost"""
3232
client = SSHClient('localhost')

pssh/utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@
2626

2727
def enable_logger(_logger, level=logging.INFO):
2828
"""Enables logging to stdout for given logger"""
29-
if logging.StreamHandler in [type(h) for h in _logger.handlers]:
29+
stream_handlers = [h for h in _logger.handlers
30+
if isinstance(h, logging.StreamHandler)]
31+
if stream_handlers:
3032
logger.warning("Logger already has a StreamHandler attached")
3133
return
3234
handler = logging.StreamHandler()

0 commit comments

Comments
 (0)