Пример #1
0
    def test_set_logging_level_with_aws_logging_method(self):
        AppLogger.configure_and_get_logger(
            logger_name='test_logging_level',
            config_section_name=AppLoggerJsonConfigName.
            default_with_watchtower_format_1(),
            watchtower_log_group="test_log_group",
            watchtower_stream_name="test_log_stream")

        AppLogger.logger.debug("debug test1")
        AppLogger.logger.info("info test1")
        AppLogger.logger.error("error test1")
        AppLogger.set_level(logging.DEBUG)
        AppLogger.logger.debug("debug test2")
        AppLogger.logger.info("info test2")
        AppLogger.logger.error("error test2")
Пример #2
0
    def test_set_logging_level_method(self):
        AppLogger.configure_and_get_logger(logger_name='test_logging_level',
                                           logging_level=logging.INFO)

        with LogCapture() as lc:
            AppLogger.logger.debug("debug test1")
            AppLogger.logger.info("info test1")
            AppLogger.logger.error("error test1")
            AppLogger.set_level(logging.DEBUG)
            AppLogger.logger.debug("debug test2")
            AppLogger.logger.info("info test2")
            AppLogger.logger.error("error test2")
            lc.check(
                ('test_logging_level', 'INFO', 'info test1'),
                ('test_logging_level', 'ERROR', 'error test1'),
                ('test_logging_level', 'DEBUG', 'debug test2'),
                ('test_logging_level', 'INFO', 'info test2'),
                ('test_logging_level', 'ERROR', 'error test2'),
            )