def test_set_logger_level_changes_existing_loggers(self):
        """Test if loggers instantiated before set_logger_level will be affected."""

        previous_logger = log_util.get_logger('test_module_1')
        self.assertEqual(previous_logger.level, logging.INFO, 'Expecting default level to be info')
        log_util.set_logger_level(logging.ERROR)
        self.assertEqual(previous_logger.level, logging.ERROR, 'Level should have changed to ERROR')
        log_util.set_logger_level(logging.INFO)
        self.assertEqual(previous_logger.level, logging.INFO, 'Level should have changed back to INFO')
Example #2
0
def _configure_logging(loglevel):
    """Configures the loglevel for all loggers.

    Args:
        loglevel (str): The loglevel to set.

    Returns:
    """
    level = LOGLEVELS.setdefault(loglevel, 'info')
    log_util.set_logger_level(level)
def _configure_logging(loglevel):
    """Configures the loglevel for all loggers."""
    level = LOGLEVELS.setdefault(loglevel, 'info')
    log_util.set_logger_level(level)
def _configure_logging(configs):
    """Configures the loglevel for all loggers."""
    desc = configs.get('loglevel')
    level = LOGLEVELS.setdefault(desc, 'info')
    log_util.set_logger_level(level)