fdutils/logs.py
def temp_file_logging_handler(logging_filepath, redirect_from_root=False):
    """ temporarily create another logger to where to send logging info to (the default is still also used)

    Args:
        logging_filepath:

    Returns:

    """
    formatter = logging.Formatter('%(asctime)s %(name)-12s %(levelname)-8s %(message)s')
    file_handler = logging.FileHandler(logging_filepath, mode='w')
    file_handler.setFormatter(formatter)

    if not redirect_from_root:
        logging.root.addHandler(file_handler)
        yield
        logging.root.removeHandler(file_handler)
    else:
        logging.getLogger(__name__).info('\n{div}\n   LOGGING IS BEING REDIRECTED TO {redirect}\n{div}\n'
                                         ''.format(div='#' * 80, redirect=logging_filepath))

        root_stream = logging.root.handlers[0].stream
        logging._acquireLock()
        try:
            logging.root.handlers[0].stream = file_handler.stream
            yield
            file_handler.close()
        finally:
            logging._releaseLock()
            logging.root.handlers[0].stream = root_stream
 temporarily create another logger to where to send logging info to (the default is still also used)

    Args:
        logging_filepath:

    Returns:

    
temporarily create another logger to where to send logging info to (the default is still also used)
temporarily create another logger to where to send logging info to ( the default is still also used )
def temp_file_logging_handler(logging_filepath, redirect_from_root=False):
    formatter = logging.Formatter('%(asctime)s %(name)-12s %(levelname)-8s %(message)s')
    file_handler = logging.FileHandler(logging_filepath, mode='w')
    file_handler.setFormatter(formatter)
    if not redirect_from_root:
        logging.root.addHandler(file_handler)
        yield
        logging.root.removeHandler(file_handler)
    else:
        logging.getLogger(__name__).info('\n{div}\n   LOGGING IS BEING REDIRECTED TO {redirect}\n{div}\n'
                                         ''.format(div='#' * 80, redirect=logging_filepath))
        root_stream = logging.root.handlers[0].stream
        logging._acquireLock()
        try:
            logging.root.handlers[0].stream = file_handler.stream
            yield
            file_handler.close()
        finally:
            logging._releaseLock()
            logging.root.handlers[0].stream = root_stream
def temp_file_logging_handler ( logging_filepath , redirect_from_root = False ) : formatter = logging . Formatter ( '%(asctime)s %(name)-12s %(levelname)-8s %(message)s' ) file_handler = logging . FileHandler ( logging_filepath , mode = 'w' ) file_handler . setFormatter ( formatter ) if not redirect_from_root : logging . root . addHandler ( file_handler ) yield logging . root . removeHandler ( file_handler ) else : logging . getLogger ( __name__ ) . info ( '\n{div}\n   LOGGING IS BEING REDIRECTED TO {redirect}\n{div}\n' '' . format ( div = '#' * 80 , redirect = logging_filepath ) ) root_stream = logging . root . handlers [ 0 ] . stream logging . _acquireLock ( ) try : logging . root . handlers [ 0 ] . stream = file_handler . stream yield file_handler . close ( ) finally : logging . _releaseLock ( ) logging . root . handlers [ 0 ] . stream = root_stream
temporarily create another logger to where to send logging info to (the default is still also used)
temporarily create another logger to where to send logging info to ( the default is still also used )
""" temporarily create another logger to where to send logging info to (the default is still also used)

    Args:
        logging_filepath:

    Returns:

    """
None
logging_filepath
None
redirect_from_root