audio: Place upper limit on length of log lines for scanner

This commit is contained in:
Thomas Adamcik 2016-10-26 22:50:16 +02:00
parent 7ecc6e5af7
commit 26e50882e6

View File

@ -212,8 +212,10 @@ def _process(pipeline, timeout_ms):
break break
if logger.isEnabledFor(log.TRACE_LOG_LEVEL) and msg.get_structure(): if logger.isEnabledFor(log.TRACE_LOG_LEVEL) and msg.get_structure():
_trace('element %s: %s', msg.src.get_name(), debug_text = msg.get_structure().to_string()
msg.get_structure().to_string()) if len(debug_text) > 77:
debug_text = debug_text[:77] + '...'
_trace('element %s: %s', msg.src.get_name(), debug_text)
if msg.type == Gst.MessageType.ELEMENT: if msg.type == Gst.MessageType.ELEMENT:
if GstPbutils.is_missing_plugin_message(msg): if GstPbutils.is_missing_plugin_message(msg):
@ -287,6 +289,9 @@ if __name__ == '__main__':
print('%-20s %s' % (key, getattr(result, key))) print('%-20s %s' % (key, getattr(result, key)))
print('tags') print('tags')
for tag, value in result.tags.items(): for tag, value in result.tags.items():
print('%-20s %s' % (tag, value)) line = '%-20s %s' % (tag, value)
if len(line) > 77:
line = line[:77] + '...'
print(line)
except exceptions.ScannerError as error: except exceptions.ScannerError as error:
print('%s: %s' % (uri, error)) print('%s: %s' % (uri, error))