How to use the acquisition.tomviz.__init__.LoggerWriter function in Acquisition

To help you get started, we’ve selected a few Acquisition examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github OpenChemistry / tomviz / acquisition / tomviz / __init__.py View on Github external
def setup_std_loggers():
    stdout_logger = logging.getLogger('stdout')
    stdout_logger.setLevel(logging.INFO)
    stderr_logger = logging.getLogger('stderr')
    stderr_logger.setLevel(logging.ERROR)
    stderr_log_writer = LoggerWriter(stderr_logger, logging.ERROR)
    stdout_log_writer = LoggerWriter(stdout_logger, logging.INFO)

    file_handler = logging.handlers.RotatingFileHandler(
        LOG_PATHS['stderr'], maxBytes=MAX_LOG_SIZE,
        backupCount=LOG_BACKUP_COUNT)
    formatter = logging.Formatter(LOG_FORMAT)
    file_handler.setFormatter(formatter)
    stderr_logger.addHandler(file_handler)

    file_handler = logging.handlers.RotatingFileHandler(
        LOG_PATHS['stdout'], maxBytes=MAX_LOG_SIZE,
        backupCount=LOG_BACKUP_COUNT)
    file_handler.setFormatter(formatter)
    stdout_logger.addHandler(file_handler)

    sys.stderr = stderr_log_writer
    sys.stdout = stdout_log_writer
github OpenChemistry / tomviz / acquisition / tomviz / __init__.py View on Github external
def setup_std_loggers():
    stdout_logger = logging.getLogger('stdout')
    stdout_logger.setLevel(logging.INFO)
    stderr_logger = logging.getLogger('stderr')
    stderr_logger.setLevel(logging.ERROR)
    stderr_log_writer = LoggerWriter(stderr_logger, logging.ERROR)
    stdout_log_writer = LoggerWriter(stdout_logger, logging.INFO)

    file_handler = logging.handlers.RotatingFileHandler(
        LOG_PATHS['stderr'], maxBytes=MAX_LOG_SIZE,
        backupCount=LOG_BACKUP_COUNT)
    formatter = logging.Formatter(LOG_FORMAT)
    file_handler.setFormatter(formatter)
    stderr_logger.addHandler(file_handler)

    file_handler = logging.handlers.RotatingFileHandler(
        LOG_PATHS['stdout'], maxBytes=MAX_LOG_SIZE,
        backupCount=LOG_BACKUP_COUNT)
    file_handler.setFormatter(formatter)
    stdout_logger.addHandler(file_handler)

    sys.stderr = stderr_log_writer