Do not log binary data during debug

Do not log binary data during debug logging of a session.
Replace the binary data with the string <binary_data> instead.

Change-Id: I5184002f3a21c5e0ee510b21b9a7884c8dccd1e3
This commit is contained in:
TerryHowe 2015-08-18 17:23:16 -06:00
parent b27489d40b
commit 9b994205a8

View File

@ -202,6 +202,11 @@ class Session(object):
if json:
data = self._json.encode(json)
if data:
if isinstance(data, six.binary_type):
try:
data = data.decode("ascii")
except UnicodeDecodeError:
data = "<binary_data>"
string_parts.append("-d '%s'" % data)
logger.debug(' '.join(string_parts))