From 26e50882e6593ef2571d587275da33fa44949b46 Mon Sep 17 00:00:00 2001 From: Thomas Adamcik Date: Wed, 26 Oct 2016 22:50:16 +0200 Subject: [PATCH] audio: Place upper limit on length of log lines for scanner --- mopidy/audio/scan.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/mopidy/audio/scan.py b/mopidy/audio/scan.py index e448fe14..a48b0c9d 100644 --- a/mopidy/audio/scan.py +++ b/mopidy/audio/scan.py @@ -212,8 +212,10 @@ def _process(pipeline, timeout_ms): break if logger.isEnabledFor(log.TRACE_LOG_LEVEL) and msg.get_structure(): - _trace('element %s: %s', msg.src.get_name(), - msg.get_structure().to_string()) + debug_text = 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 GstPbutils.is_missing_plugin_message(msg): @@ -287,6 +289,9 @@ if __name__ == '__main__': print('%-20s %s' % (key, getattr(result, key))) print('tags') 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: print('%s: %s' % (uri, error))