(self, logfile, debug)
Set up the global logger.
Set up the global logger.
Set up the global logger .
def prepare(self, logfile, debug):
        """Set up the global logger."""
        # get log stream and level from options
        loglevel = logging.DEBUG if debug else logging.INFO
        root_logger = self.reset()
        root_logger.setLevel(loglevel)
        if logfile:
            logstream = io.open(logfile, 'w', encoding='utf_8', errors='replace')
        else:
            logstream = stdio.stderr
        # write out cached logs
        logstream.write(self._logstream.getvalue())
        handler = logging.StreamHandler(logstream)
        handler.setFormatter(LOGGING_FORMATTER)
        root_logger.addHandler(handler)
def prepare ( self , logfile , debug ) : # get log stream and level from options loglevel = logging . DEBUG if debug else logging . INFO root_logger = self . reset ( ) root_logger . setLevel ( loglevel ) if logfile : logstream = io . open ( logfile , 'w' , encoding = 'utf_8' , errors = 'replace' ) else : logstream = stdio . stderr # write out cached logs logstream . write ( self . _logstream . getvalue ( ) ) handler = logging . StreamHandler ( logstream ) handler . setFormatter ( LOGGING_FORMATTER ) root_logger . addHandler ( handler )