def _get_value(self, stream): try: return decode_output(stream.getvalue()) except UnicodeError: # Error occurs if non-ASCII chars logged both as str and unicode. stream.buf = decode_output(stream.buf) stream.buflist = [decode_output(item) for item in stream.buflist] return stream.getvalue()
def _format_output(self, output): if output.endswith('\n'): output = output[:-1] return decode_output(output, force=True)