'Truncates a potentially long log down to a specified maximum length.'

@staticmethod
def _truncate(line, max_length=_MAX_LINE_SIZE):

    if (len(line) > max_length):
        original_length = len(line)
        suffix = ('...(length    %d)' % original_length)
        line = (line[:(max_length - len(suffix))] + suffix)
    return line
