Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
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