island: Handle lower case log levels in server config

This commit is contained in:
Mike Salvatore 2021-05-11 13:40:58 -04:00
parent 5ea241f120
commit 08668f3eae
2 changed files with 15 additions and 1 deletions

View File

@ -48,6 +48,6 @@ def setup_logging(data_dir_path, log_level):
logger_configuration["handlers"]["file_handler"]["filename"] = os.path.join( logger_configuration["handlers"]["file_handler"]["filename"] = os.path.join(
data_dir_path, ISLAND_LOG_FILENAME data_dir_path, ISLAND_LOG_FILENAME
) )
logger_configuration["root"]["level"] = log_level logger_configuration["root"]["level"] = log_level.upper()
logging.config.dictConfig(logger_configuration) logging.config.dictConfig(logger_configuration)

View File

@ -64,3 +64,17 @@ def test_setup_logging_console_log_level_info(capsys, tmpdir):
captured = capsys.readouterr() captured = capsys.readouterr()
assert TEST_STRING not in captured.out assert TEST_STRING not in captured.out
def test_setup_logging_console_log_level_lower_case(capsys, tmpdir):
DATA_DIR = tmpdir
LOG_LEVEL = "debug"
TEST_STRING = "Hello, Monkey! (Console; Log level: debug)"
setup_logging(DATA_DIR, LOG_LEVEL)
logger = logging.getLogger("TestLogger")
logger.debug(TEST_STRING)
captured = capsys.readouterr()
assert TEST_STRING in captured.out