if opt.logfile:


    class MyFormatter(logging.Formatter):

        def format(self, record):
            return plain(record.msg)
fh = logging.FileHandler(opt.logfile)
fh.setLevel(logging.INFO)
formatter = MyFormatter('%(message)s')
fh.setFormatter(formatter)
logging.getLogger('').addHandler(fh)
logger.info(error('There was a problem with the program'))
logger.info('This is normal ' + standout('and this stands out'))
Печать в STDOUT и файл журнала при удалении цветовых кодов ANSI