'Log the ASCII traceback into a file object.'

def log(self, logfile=None):

    if (logfile is None):
        logfile = sys.stderr
    tb = (self.plaintext.rstrip() + u'\n')
    if PY2:
        tb = tb.encode('utf-8', 'replace')
    logfile.write(tb)
