Skip to content
This repository has been archived by the owner on Feb 13, 2020. It is now read-only.

Commit

Permalink
Always have handlers on client_logger to eliminate annoying warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
thieman committed Feb 15, 2016
1 parent 0bca6dd commit 997aade
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions dusty/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def close_socket_logger():
handler = None

def configure_client_logging():
client_logger.addHandler(logging.NullHandler())
logging.basicConfig(stream=sys.stdout,
level=logging.INFO,
format='%(message)s')
Expand All @@ -71,14 +72,11 @@ def streaming_to_client():
was originally created for streaming Compose up's
terminal output through to the client and should only be
used for similarly complex circumstances."""
handler = None
# Avoid annoying "No handlers could be found" warning
if client_logger.handlers:
for handler in client_logger.handlers:
if hasattr(handler, 'append_newlines'):
break
else:
handler = None
for handler in client_logger.handlers:
if hasattr(handler, 'append_newlines'):
break
else:
handler = None
old_propagate = client_logger.propagate
client_logger.propagate = False
if handler is not None:
Expand Down

0 comments on commit 997aade

Please sign in to comment.