(filename, level=constants.DEBUG)
Initialize the logger.

    :param filename: base name of the log file
    :param level: logging level (Default value = DEBUG)
Initialize the logger.
Initialize the logger .
def init(filename, level=constants.DEBUG):
    """Initialize the logger.

    :param filename: base name of the log file
    :param level: logging level (Default value = DEBUG)

    """
    global LOG_FILE
    LOG_FILE = os.path.join(tempfile.gettempdir(), filename)
    with open(LOG_FILE, 'w'):
        pass

    global LOGGER
    LOGGER = logging.getLogger('Three.Export')
    LOGGER.setLevel(LEVELS[level])

    if not LOGGER.handlers:
        stream = logging.StreamHandler()
        stream.setLevel(LEVELS[level])

        format_ = '%(asctime)s - %(name)s - %(levelname)s: %(message)s'
        formatter = logging.Formatter(format_)

        stream.setFormatter(formatter)

        file_handler = logging.FileHandler(LOG_FILE)
        file_handler.setLevel(LEVELS[level])
        file_handler.setFormatter(formatter)

        LOGGER.addHandler(stream)
        LOGGER.addHandler(file_handler)
def init ( filename , level = constants . DEBUG ) : global LOG_FILE LOG_FILE = os . path . join ( tempfile . gettempdir ( ) , filename ) with open ( LOG_FILE , 'w' ) : pass global LOGGER LOGGER = logging . getLogger ( 'Three.Export' ) LOGGER . setLevel ( LEVELS [ level ] ) if not LOGGER . handlers : stream = logging . StreamHandler ( ) stream . setLevel ( LEVELS [ level ] ) format_ = '%(asctime)s - %(name)s - %(levelname)s: %(message)s' formatter = logging . Formatter ( format_ ) stream . setFormatter ( formatter ) file_handler = logging . FileHandler ( LOG_FILE ) file_handler . setLevel ( LEVELS [ level ] ) file_handler . setFormatter ( formatter ) LOGGER . addHandler ( stream ) LOGGER . addHandler ( file_handler )